Hello, Friends,
I have a puzzle I cannot solve. I want to evaluate parameters created with web_reg_save_param_ex( ) using parameter names I've "constructed" in sprintf or lr_param_sprintf( ):
- using web_reg_save_param_ex( ) with "ParamName=ErrorMessage" and "Ordinal=all" flags, the usual parameters are created.
- so I get ErrorMessage_count=3, ErrorMessage_1=error1, ErrorMessage_2=error2, ErrorMessage_3=error3.
- I want to print the value of each parameter, but I don't know how many errors there will be in each test run, so I don't want to hard-code something like lr_error_message("Error 1 is: %s", lr_eval_string("{ErrorMessage_1}"));
- however, this works fine, the result will say "Error 1 is: error1
- I've "constructed" a new parameter in a loop, one for each error, such aslr_param_sprintf("ErrorMessage_number", "ErrorMessage_%d", j ); where j changes with each iteration of the loop. This works fine.
- so in loop 1, lr_eval_string("{ErrorMessage_number}") evaluates to ErrorMessage_1, in loop 2, lr_eval_string("{ErrorMessage_number}") evaluates to ErrorMessage_2, etc.
- now the puzzle - I'm unable to evaluate those constructed parameters. Ultimately I want to print them out in an error message, likelr_error_message("error %i is %s", j, lr_eval_string("{ErrorMessage_number}"));
- I know the above example will evaluate to "error 1 is ErrorMessage_1" but I've tried a hundred different variations, and still cannot get it to give me "error 1 is error1", "error 2 is error2", etc.
- no matter what I do, I get the parameter name instead of the value of the parameter in the message.
- logically it seems this should work, but it does not: lr_error_message("error %i is %s", j, lr_eval_string(lr_eval_string("{ErrorMessage_number}")))
- even this example prints "error 2 is ErrorMessage_2"
If you have the trick I need to get this to work, it will be a very Happy New Year!
Thanks