Highlighted
Absent Member.
Absent Member.
157 views

Parameter not transposing properly.. should be simple mistake...

Hi all,
I can't figure out why the following is not resolving properly....

I've grabbed an array of results and stored them in a parameter as follows:
~~~~~~~
web_reg_save_param("FileID", "LB=ctx1\" Id=\"", "RB=\"", "Ord=All", LAST);
~~~~~~~

This works fine, and the results that come back in the log are:

~~~~~~~
Notify: Saving Parameter "FileID_1 = 8"
Notify: Saving Parameter "FileID_2 = 7"
Notify: Saving Parameter "FileID_count = 2"
~~~~~~~

I'm then trying to get the FileID_count and make it pick one of the array values at random.

I then do the following to extract the value:

~~~~~~~
int fileCount;
....
fileCount = atoi(lr_eval_string("{FileID_count}"));
lr_output_message("This Value = %d",fileCount);
~~~~~~~

The result of which is "This Value = 0"

if I use a %i over a %d, I get "This Value = 21278168"

Can anyone see why I'm not getting a simple "2" back as my fileCount? It's not making sense to me and driving me nuts! LOL

Any assistance you could offer - I'd be very grateful.
Regards,
Simon
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

Re: Parameter not transposing properly.. should be simple mistake...

The solution was in fact, very simple....
I had changed the parameter braces from {} to [] - I *never* have to change these, but in this case I needed to.... so all of my referencing was still using {}. Once I transposed to [] - everything was fine.

That's what you get for getting comfortable with default settings, I guess.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.