Handling "Event" Parameter when running as Headless Client

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Handling "Event" Parameter when running as Headless Client

Postby sabbatarian7 » Tue May 03, 2016 7:30 am


What I am doing is converting a process to be run as headless client, where previously it was running as a form process (User clicks, it starts, and run).
Now issue is, during that process "event" is used on multiple occasions and previously event used to come from the click that user used to do TO start the process. now as I am running it as headless client, there are no clicks so how to handle that "event" parameter?

1) event.getFormName() is used in my process. but when there is no triggering event, how am I suppose to create the same effect so the process can run without drastic changes.
2) I tried creating JSEvent but obviously that will not have the properties, it will be a null event.

Please let me know if I am not clear or if I am missing a basic point, I am only 3 months experienced with Servoy. I will explain this more if required.
Thank you.
Servoy Developer.
Servoy version 5.2.11
Posts: 4
Joined: Wed Feb 24, 2016 8:25 am

Re: Handling "Event" Parameter when running as Headless Clie

Postby mboegem » Tue May 03, 2016 12:11 pm

Hi sabbatarian7,

first of all welcome to the forum since this is your first post.

Your point is clear, you are breaking a pretty essential design rule: keep business logic and UI separated.
Of course there are situations where you need code depending on specific actions on the form and/or elements, but this should always be code in private functions.

Besides when you are using a headless client, be aware that it can not use forms (or at least the UI part of it)
Essentially all code executed within the headless client should be from functions in your top level scopes (ie. globals)

So take out the business logic from the code you're working on and use this in your headless client.
This should be possible, however hard to explain since we don't know the exact usecase.

Nevertheless: Hope this is pointing you in the right direction.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

User avatar
Posts: 1574
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Handling "Event" Parameter when running as Headless Clie

Postby sabbatarian7 » Wed May 04, 2016 6:41 am


I completely understand your solution, But I can't extract out the process completely into top level scopes (globals) because it is too complex and dependent on multiple forms, So I guess I will have to carefully handle the places where the UI is affected.

I was thinking about using "isBatchProcess" check by having batch Process arguments as true. You already cleared almost all of it just can you verify that "isBatchProcess" will be right approach? Or is there anything better than that in servoy?

if (isBatchProcess)
//save withour any UI changes
//UI changes then save
Servoy Developer.
Servoy version 5.2.11
Posts: 4
Joined: Wed Feb 24, 2016 8:25 am

Re: Handling "Event" Parameter when running as Headless Clie

Postby swingman » Wed May 04, 2016 7:26 am

Hi, I would extract as much as possible of the logic and put it into a (global) scope or an entity scope, passing JSRecords as parameters.
Code: Select all

Then rebuild the functionality of the UI using these functions. The code in the UI will become much shorter, reusing the elements needed by the batch processor.

This way you can debug and check the logic in the Developer, which is much much easier than trying to work out what is happening in a headless client.

Hope this helps,
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK

http://www.postgresql.org - The world's most advanced open source database.
User avatar
Posts: 1379
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 0 guests