headlessclient and db triggers

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

headlessclient and db triggers

Postby Ugo » Sun Dec 11, 2011 1:29 pm

Hello,

I'm currently using db triggers to update parent counts ( no calculations ) within a onAfterUpdate event. Users are complaining the method takes too long, so I'm investigating HeadlessClient to process this method server side.

I'm wondering if Headless can be used within a db trigger.

Here's my current logic.

Within the onRecordUpdate in the line_items Table, an object with those records where the parent needs to be updated ( changes on amounts or parent foreign key) is created and holds each parent record value to be updated.
These updates are then processed through a 'myLongMethod' within the onAfterUpdate method in the line_items Table, that takes the object and loops through the parent records in that object to update all counts.

What I'd like to do is execute 'myLongMethod' with a Headless.
As far as I can see, I get a callback exception from the callback method with 'global method name' as the data from the JSEvent.

Any idea about what is wrong or if it is simply not possible to use Headless within db triggers ?

Thanks

Ugo
Ugo Di Luca

SaaS Software Development Engineer ( Paris - France )
Cegid - http://www.cegid.fr
FileMaker Developer, trainer and consultant
DL Systems- http://www.dlsystems.fr
User avatar
Ugo
 
Posts: 28
Joined: Mon Dec 25, 2006 2:26 pm
Location: Paris, France

Re: headlessclient and db triggers

Postby mboegem » Sun Dec 11, 2011 2:14 pm

Hi Ugo,

if you include your hc-solution as a module in your main solution, you'll be able to start it in developer as a headless client and add for example application.output(....) to see where it's getting wrong.
Note: if you fire a headless client like this, the onOpen method of the hc-solution is NOT getting fired, it's even different: if you've specified an onOpen method in your main solution, that one is getting fired!

On the other hand: you might just create a form into the hc-solution so you'll be able to run it as a solution in developer where you can enter data on the form.
As it's a normal solution, you can just debug it.

hope this helps
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1382
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: headlessclient and db triggers

Postby Ugo » Sun Dec 11, 2011 6:25 pm

Thanks Marc,

I was afraid it would not have been possible to run a HCL within db triggers.

What you're suggesting is that I'd build a separate solution for my HCL calls, rather than creating the HeadlessClient and perform these updates within the current solution where the logic takes place ( and where triggers are executed).
Is that it ?

Ugo
Ugo Di Luca

SaaS Software Development Engineer ( Paris - France )
Cegid - http://www.cegid.fr
FileMaker Developer, trainer and consultant
DL Systems- http://www.dlsystems.fr
User avatar
Ugo
 
Posts: 28
Joined: Mon Dec 25, 2006 2:26 pm
Location: Paris, France

Re: headlessclient and db triggers

Postby mboegem » Sun Dec 11, 2011 9:46 pm

Ugo wrote:I was afraid it would not have been possible to run a HCL within db triggers.

HC is just a normal client without GUI, this is what makes it also hard to debug.

Ugo wrote:What you're suggesting is that I'd build a separate solution for my HCL calls, rather than creating the HeadlessClient and perform these updates within the current solution where the logic takes place ( and where triggers are executed).
Is that it ?

Not really, your question was: 'what is wrong?'
There's only one way to find out: debug.
What I'm suggesting is that you run your hc solution in developer:
1) as a temporary module of your current solution, so that you can really make the call and 'debug' it using console outputs.
2) run it as a normal solution, but create one form. This way you'll be able to debug it after editing a value on the form.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1382
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: headlessclient and db triggers

Postby Ugo » Tue Jan 17, 2012 12:11 pm

Marc,

I had some other projects in the meantime, so pardon my silence.

I'm having some hard time with HLC in general actually. Looking at the server log, what I can see is that while the 'LongGlobalMethod' I'm trying to execute is included in my Module A and my HCClient is correctly created with the credentials for this module A, Servoy tries to trigger a method in the 'login' solution.

Whatever the options selected for the module A ( mustAuthenticate, loginSolutionName, loginForm ), I get the error that 'LongGlobalMethod' cannot resolve to a method in my login module. Curiously, I'm efficiently using another HeadlessClient to accomplish some provisioning operations on Login, I'm suspecting this provisoning HCL is working correctly because it is triggered from the login module itself.

I'm working with Servoy 5.2.4

Any idea how I can bypass the login module in order to lauch this method in module A ?

Thanks

Ugo
Ugo Di Luca

SaaS Software Development Engineer ( Paris - France )
Cegid - http://www.cegid.fr
FileMaker Developer, trainer and consultant
DL Systems- http://www.dlsystems.fr
User avatar
Ugo
 
Posts: 28
Joined: Mon Dec 25, 2006 2:26 pm
Location: Paris, France


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 1 guest