Hi. Please can you help.
I am trying to setup a variable onclick event and am experiencing some problems.
I noted one of the Variable Hyperlink forum topics mentions it is possible to embed +get into the command string. This is exactly the functionality that I am after just with onclick and not hyperlink.
In this example I am trying to run a crystal report, using executable crexport, from a button. The report requires a single parameter which in this case is the employee ID.
For my onload event I have loadPCCommandApplet() and what I currently have linked to the button onclick is the following:-
var command = "C:\\cre\\crexport -u userid -p password –f C:\\cre\\engcard.rpt -e print -d datalib -a empid:"+get("WPRTENG"); runPCCommand(command);
WPRTENG in this case is an output field visible on the screen.
The report is running but it is not receiving the variable value for WPRTENG.
Is my assumption that the +get would work in this scenario incorrect?
Is there any other way of attaching the onclick event to value or variable field?
Thanks in advance.
Variable onclick event
-
- 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:
-
- 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: Variable onclick event
With a bit more searching through your forums it seems that this should work. I have further confirmed that my field ID matches (spelling and case) and tried input and output fields. Not sure what I am missing? Monday morning blindness perhaps?
-
- 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: Variable onclick event
Sorry - I missed some double-quotes, around the parameter values, in the original supplied command string and they are required.
So I think a syntax problem nothing to do with the get. That being so it now leaves me with a new issue on the +, concatenate, as it seems to perform a %trim by default.
The syntax for the last portion of the request should be -a "EMPID:2903" where 2903 is the variable value. To accomplish this, as """ is obviously not valid, I have declared a screen variable, WQTE, and initialised to as x'7F' (double quotes). The syntax I then tried is:-
var command = "C:\\cre\\crexport -u userid -p password -f C:\\cre\\engcard.rpt -e print -d datalib -a" + " " +get("WQTE") + "empid:"+get("WPRTENG")+get("WQTE"); runPCCommand(command);
No matter what I try the blank space following, the -a, in the command is trimmed resulting in -a"EMPID:2903" as opposed to -a "EMPID:2903".
I know this is not the same question I intially asked, but how do I force the concatenate to accept a space after my -a?
So I think a syntax problem nothing to do with the get. That being so it now leaves me with a new issue on the +, concatenate, as it seems to perform a %trim by default.
The syntax for the last portion of the request should be -a "EMPID:2903" where 2903 is the variable value. To accomplish this, as """ is obviously not valid, I have declared a screen variable, WQTE, and initialised to as x'7F' (double quotes). The syntax I then tried is:-
var command = "C:\\cre\\crexport -u userid -p password -f C:\\cre\\engcard.rpt -e print -d datalib -a" + " " +get("WQTE") + "empid:"+get("WPRTENG")+get("WQTE"); runPCCommand(command);
No matter what I try the blank space following, the -a, in the command is trimmed resulting in -a"EMPID:2903" as opposed to -a "EMPID:2903".
I know this is not the same question I intially asked, but how do I force the concatenate to accept a space after my -a?
-
- 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: Variable onclick event
You need a blank after the -a in your command string. You have this:
What you want to have is a blank after the -a, so you want this:
Also you should be able to insert quotes into your string by preceding them with a backslash. Backslash is a special character used to "escape" the character that follows it (that's why you had to double-up the backslashes when you did c:\ at the start of your string).
for example:
Or, alternately, you can put double quotes inside of single quotes (and vice-versa) without them being interpreted in any special way. So you could do this, instead, if you think it's more elegant (but then you'll have problems if you insert single quotes):
Does that help?
Code: Select all
var command = ". . . -d datalib -a" . . .
Code: Select all
var command = ". . . -d datalib -a " . . .
for example:
Code: Select all
var command = "C:\\cre\\crexport -u userid -p password -f C:\\cre\\engcard.rpt -e print -d datalib -a \"empid:"+get("WPRTENG")+"\""; runPCCommand(command);
Code: Select all
var command = 'C:\\cre\\crexport -u userid -p password -f C:\\cre\\engcard.rpt -e print -d datalib -a "empid:'+get("WPRTENG")+'"'; runPCCommand(command);
-
- 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: Variable onclick event
Yes thank you so much Scott. Cannot believe something so simple caused me so much hassle.
Who is online
Users browsing this forum: No registered users and 5 guests