Hi, I have the following formula in the Records Selection in a subreport. I use version 7 of Crystal.
ToText({crecap_view.NUF_GRANT_TYPE},0,"","" in {?Pm-@Make grant type paramater a text string for passing to the subreports};
NUF_GRANT_TYPE is type number and can only return values of 0,1,2.
The big long paramter is a text string. In the main report I ask the user to pass in a multiple value number parameter. Unfortunately CR 7 does not allow me to pass this directly to the subreport. So I parse this parameter out in the main report with the following formula which turns it into a string to pass to the subreport.
//this formula parses out the grant type paramater and makes it a text string for passing to the subreports
//in crystal 7 you cannot pass an array to a subreport
//chr(34) is the double quote "
//?Grant Types is the multiple value number parameter.
WhilePrintingRecords;
NumberVar elementsInArray := Count({?Grant Types});
Shared StringVar arraytext := "[" + chr(34) + ToText({?Grant Types}[1],0) + chr(34);
arraytext := arraytext + if elementsInArray >= 2
then "," + chr(34) + ToText({?Grant Types}[2],0) + chr(34)else "";
arraytext := arraytext + if elementsInArray = 3
then "," + chr(34) + ToText({?Grant Types}[3],0) + chr(34)else "";
arraytext := arraytext + "]";
arraytext;
So this formula returns ["0","2"] for example.
So my question is: Now knowing what the paramater string looks likes that is being passed to the subreport is my formula (the one at the top of the post) correct? Do you see any problems with it. I ask this because my original formula for the ToText formula, ToText({crecap_view.NUF_GRANT_TYPE},0,"","" did not have the ,0,"","" in it and it worked for me but not on my user machine. So I am trying to make this bullet proof. I am also concerned about the double quotes that surround my numbers in the string parameters I pass (["0","2']). Do I need them?
Thanks,
ToText({crecap_view.NUF_GRANT_TYPE},0,"","" in {?Pm-@Make grant type paramater a text string for passing to the subreports};
NUF_GRANT_TYPE is type number and can only return values of 0,1,2.
The big long paramter is a text string. In the main report I ask the user to pass in a multiple value number parameter. Unfortunately CR 7 does not allow me to pass this directly to the subreport. So I parse this parameter out in the main report with the following formula which turns it into a string to pass to the subreport.
//this formula parses out the grant type paramater and makes it a text string for passing to the subreports
//in crystal 7 you cannot pass an array to a subreport
//chr(34) is the double quote "
//?Grant Types is the multiple value number parameter.
WhilePrintingRecords;
NumberVar elementsInArray := Count({?Grant Types});
Shared StringVar arraytext := "[" + chr(34) + ToText({?Grant Types}[1],0) + chr(34);
arraytext := arraytext + if elementsInArray >= 2
then "," + chr(34) + ToText({?Grant Types}[2],0) + chr(34)else "";
arraytext := arraytext + if elementsInArray = 3
then "," + chr(34) + ToText({?Grant Types}[3],0) + chr(34)else "";
arraytext := arraytext + "]";
arraytext;
So this formula returns ["0","2"] for example.
So my question is: Now knowing what the paramater string looks likes that is being passed to the subreport is my formula (the one at the top of the post) correct? Do you see any problems with it. I ask this because my original formula for the ToText formula, ToText({crecap_view.NUF_GRANT_TYPE},0,"","" did not have the ,0,"","" in it and it worked for me but not on my user machine. So I am trying to make this bullet proof. I am also concerned about the double quotes that surround my numbers in the string parameters I pass (["0","2']). Do I need them?
Thanks,