Question
· 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
Discussion (5)2
Log in or sign up to continue

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.