Onclick Event and Multiple RunPCCommand

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
brett.elston
Profound User
Posts: 62
Joined: Fri Nov 02, 2012 6:28 am
First Name: Brett
Last Name: Elston
Company Name: NAC
Phone: Lanseria
Address 1: Johannesburg
State / Province: Outside Canada/USA
Country: South Africa
Contact:

Onclick Event and Multiple RunPCCommand

Post by brett.elston »

Hi,

I am having a small problem with the script for an onclick event. I have a print button that needs to launch two Crystal reports. For whatever reason only the first RunPCCommand is executed. As a solution I can create multiple buttons to launch each report seperately but hoping that I am maybe just missing something obvious.

Please could you tell me where I am going wrong ? (Script below)

Best Regards

Brett

var command = "\\\\amasisprnsrv01\\CREXPORT\\crexport -u user -p password -f \\\\amasisprnsrv01\\crystal\\MROCRD.rpt -e print -d S06D632P -s DATALIB -a WSDOC1:"+get("PRTDOC1")+" -a WSDOC2:"+get("PRTDOC2")+" -a WSENV:"+get("PRTENV")+" -l";runPCCommand(command);
var command = "\\\\amasisprnsrv01\\CREXPORT\\crexport -u user -p password -f \\\\amasisprnsrv01\\crystal\\MROINVD.rpt -e print -d S06D632P -s DATALIB -a WSENV:"+get("PRTENV")+ "-a WSDOC1A:"+get("PRTDOC1")+" -a WSDOC2A:"+get("PRTDOC2")+" -l";runPCCommand(command);
pui.click('ENTER');
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Onclick Event and Multiple RunPCCommand

Post by Scott Klement »

I wrote up a quick test, and it worked for me. It might be failing for you due to the pui.click() call, however?

A few thoughts:

a) Even though you can launch two PC commands, it does not wait until the first has finished. So they will be running at the same time.

b) the pui.click() may submit the screen back to the server. This might be a problem if the previous runPCCommand is still in progress because it will remove your screen from the display and re-build it, and that means it'll stop the code that's running runPcCommand

c) pui.click() does not take a key name as a parameter. So when you code pui.click("ENTER") it is looking for a widget with id="ENTER". If you are trying to replicate the behavior of the user pressing the enter key, you can just do pui.click() (with no parameter). This will submit the screen without clicking a particular widget, just as it would if the user pressed enter.

Let me know if that helps at all.
brett.elston
Profound User
Posts: 62
Joined: Fri Nov 02, 2012 6:28 am
First Name: Brett
Last Name: Elston
Company Name: NAC
Phone: Lanseria
Address 1: Johannesburg
State / Province: Outside Canada/USA
Country: South Africa
Contact:

Re: Onclick Event and Multiple RunPCCommand

Post by brett.elston »

Hi Scott,

Thank you – most helpful.

I did not take into account that both commands would be run simultaneously. This causes a lock on which causes the second command to fail.
I have now tried with a setTimeout(5000), between the two executions, but it seems to have no effect. Does it continue regardless?
brett.elston
Profound User
Posts: 62
Joined: Fri Nov 02, 2012 6:28 am
First Name: Brett
Last Name: Elston
Company Name: NAC
Phone: Lanseria
Address 1: Johannesburg
State / Province: Outside Canada/USA
Country: South Africa
Contact:

Re: Onclick Event and Multiple RunPCCommand

Post by brett.elston »

Sorry, it is the syntax of my seTimeout that is wrong. Providing I can execute the command, within setTimeout, is this a viable way forcing a delay?
brett.elston
Profound User
Posts: 62
Joined: Fri Nov 02, 2012 6:28 am
First Name: Brett
Last Name: Elston
Company Name: NAC
Phone: Lanseria
Address 1: Johannesburg
State / Province: Outside Canada/USA
Country: South Africa
Contact:

Re: Onclick Event and Multiple RunPCCommand

Post by brett.elston »

Thank you Scott,

I think I got it with the code below.

Best Regards

Brett

var command = "\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROCRD.rpt -e print -d S06D632P -s DATALIB -a WSDOC1:"+get("PRTDOC1")+" -a WSDOC2:"+get("PRTDOC2")+" -a WSENV:"+get("PRTENV")+" -l";runPCCommand(command);
setTimeout(function(){var command = "\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROINVD.rpt -e print -d S06D632P -s DATALIB -a WSENV:"+get("PRTENV")+" -a WSDOC1A:"+get("PRTDOC1")+" -a WSDOC2A:"+get("PRTDOC2")+" -l";runPCCommand(command); }, 2000);
pui.click();
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests