Hi,
I have a radio button group, with three values, and would like to use a button "onclick" event to run a crystal report passing this value as a parameter.
We already have this working with other reports and variables however the +get operation works with the specific field ID in those cases. Now however each radio button obviously has its own ID and the linking is done on the group field. How do I retrieve the group field value? What am I missing?
Your help would be much appreciated.
Thanks
FYI the current onclick event except the RBGROUPP parameter is not working:-
var command = "\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQT.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -a WSMODE:"+get("RBGROUPP")+" -l";runPCCommand(command);
pui.click('ButPrintQt');
Radio Button Groups and +Get
-
- 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:
-
- 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: Radio Button Groups and +Get
You can do this by checking the 'checked' and 'radioValue' properties of the widget object. For example, assuming you have 3 radio buttons with ids of "rb1", "rb2" and "rb2" (that are all bound to the same radio button group, "RBGROUPP") you can do this:
Now the 'wsmode' variable will have the value, and you can concatenate that into your PC command, or whatever you need to do with it.
Code: Select all
var wsmode;
if (getObj("rb1").checked) wsmode=getObj("rb1").radioValue;
if (getObj("rb2").checked) wsmode=getObj("rb2").radioValue;
if (getObj("rb3").checked) wsmode=getObj("rb3").radioValue;
-
- 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: Radio Button Groups and +Get
Thank you Scott,
It's exactly what I was looking for and it works a charm.
Kind Regards
Brett
It's exactly what I was looking for and it works a charm.
Kind Regards
Brett
-
- 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: Radio Button Groups and +Get
One more quick question please?
Using variable wsmode within the command worked perfectly. However now the requirement is to run separate reports based on the value of the variable.
I tried this below code:-
var wsmode;
var command;
if (getObj("PrtRb1").checked) wsmode=getObj("PrtRb1").radioValue;
if (getObj("PrtRb2").checked) wsmode=getObj("PrtRb2").radioValue;
if (getObj("PrtRb3").checked) wsmode=getObj("PrtRb3").radioValue;
if (getObj("PrtRb4").checked) wsmode=getObj("PrtRb4").radioValue;
if (wsmode="E") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQT.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="A") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQTA.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="1") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQT1.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="D") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQTD.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
runPCCommand(command);
pui.click('ButPrintQt');
This however shows a warning in the onclick event screen, "assignment in conditional expression", and the value of command variable always set to the last value (if wsmode="D)
Really sorry, your js does not seem happy with the standard js { } (curly brackets) if/else logic. I did try that before hand and then resorted to this attempt.
Thanks
Using variable wsmode within the command worked perfectly. However now the requirement is to run separate reports based on the value of the variable.
I tried this below code:-
var wsmode;
var command;
if (getObj("PrtRb1").checked) wsmode=getObj("PrtRb1").radioValue;
if (getObj("PrtRb2").checked) wsmode=getObj("PrtRb2").radioValue;
if (getObj("PrtRb3").checked) wsmode=getObj("PrtRb3").radioValue;
if (getObj("PrtRb4").checked) wsmode=getObj("PrtRb4").radioValue;
if (wsmode="E") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQT.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="A") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQTA.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="1") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQT1.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
if (wsmode="D") command="\\\\amasisprnsrv01\\CREXPORT\\crexport -u creps -p creps -f \\\\amasisprnsrv01\\crystal\\MROQTD.rpt -e print -d S06D632P -s DATALIB -a WSDOC1A:"+get("WHQT1P")+" -a WSDOC2A:"+get("WHQT2P")+" -l";
runPCCommand(command);
pui.click('ButPrintQt');
This however shows a warning in the onclick event screen, "assignment in conditional expression", and the value of command variable always set to the last value (if wsmode="D)
Really sorry, your js does not seem happy with the standard js { } (curly brackets) if/else logic. I did try that before hand and then resorted to this attempt.
Thanks
-
- 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: Radio Button Groups and +Get
The syntax of your 'if' statements are wrong.
You have it like this:
It should be this:
A single = means "assignment" (i.e. you are changing wsmode to "E"), whereas a double like == means "compare" (check if wsmode == "E"). You can also use three, like === to prevent Javascript from converting data types before making the comparison.
You have it like this:
Code: Select all
if (wsmode="E") ...do something...
Code: Select all
if (wsmode=="E") ...do something...
Not sure what you mean by this. Which js do you mean by "your js"? The example I posted earlier doesn't use any { } or 'else' logic...?Really sorry, your js does not seem happy with the standard js { } (curly brackets) if/else logic. I did try that before hand and then resorted to this attempt.
-
- 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: Radio Button Groups and +Get
Thank you Scott,
The "==" was staring me right in the face and I couldn't see it.
When I refer to "Your" I meant Profound and not your example specifically.
Regards
The "==" was staring me right in the face and I couldn't see it.
When I refer to "Your" I meant Profound and not your example specifically.
Regards
Who is online
Users browsing this forum: No registered users and 4 guests