Written by

Question Nezla · Aug 14, 2023

Do Vs Job method call

Hi Guys,

below is a javascript sample code in one of my methods in a CSP page where I'm loading some data from a global to a Javascript arrays, the problem is that if I call the method with do (d ..mymethod()) everything works fine but calling it with Job (J ..mymethod()) it seems that the javascript part is not working, is there a way to fix this?    

The reason why I'm using Job call because I need it to run in background and not to hold other processes.  

&js<
    Sensor='#(Sensor)#';
    maindatafx[Sensor].push(ConvertArr((Fdte),'#(FXData)#'))
linechartdatafx[Sensor].push((Fnum),'#(XFData)#');
linechartlblfx[Sensor].push('#(FLabel)#');maindatafy[Sensor].push(ConvertArr((Fdte),'#(FYData)#'))
linechartdatafy[Sensor].push((Fnum),'#(YFData)#');
linechartlblfy[Sensor].push('#(FLabel)#');maindatafz[Sensor].push(ConvertArr((Fdte),'#(FZData)#'))
linechartdatafz[Sensor].push((Fnum),'#(ZFData)#');
linechartlblfz[Sensor].push('#(FLabel)#');
>

Thanks

Product version: Caché 2014.1

Comments

Ben Spead · Aug 14, 2023

The issue is that you need the logic to run synchronously in process so that it can actually write out the JavaScript as part of the response to the web client. If you job off the logic it will run in a separate process and there is no way to return the JavaScript to the caller because this is done asynchronously and the response has already been sent by the time your job will finish in all likelihood. If you need something to run asynchronously then use the #call() command in your CSP page.

0
Nezla  Aug 14, 2023 to Ben Spead

What the syntax of the #call() ?

Thanks

0
Nezla  Aug 14, 2023 to Nezla

never mind, got it 

0
Robert Cemper · Aug 14, 2023

With JOB you start an independent process in background.
You can pass any variable you may need.
But you can't pass the connection to the CSP page with all its settings.
the connection stays with the foreground job. 

0
Nezla · Aug 14, 2023

Thanks Guys

0