Highlighted
Absent Member.
Absent Member.
2936 views

Unable to Substitute value in the ITEMDATA variable

Jump to solution

I am trying to substitute "TempValue" in the ITEM DATA ( which is 1.01) ,
but when I run the code, the text tempvalue is getting substituted .

Can you please tell me what should I do ?

 

float AmountTobeTransf;
char TempValue[256];
AmountTobeTransf = 1.01;
lr_param_sprintf(TempValue,"%.2f",AmountTobeTransf);


web_submit_data("Test",
"Action = XX",
"Method =XX ",
"TargetFrame=",
"RecContentType=text/html",
"Referer=XX",
"Snapshot=XX",
"Mode=HTML",
ITEMDATA,
"Name = Hello ", Value ={TempValue}",ENDITEM,
LAST);

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

you are using

lr_something. that always needs lr_eval

because they are LR parameter

 

you need to put string only which does not require eval

 

sprintf("TempValue","%.2f",AmountTobeTransf);

 

 

 

View solution in original post

0 Likes
8 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

looks to be a syntax issue:

 

Expected: "Name = Hello ", "Value ={TempValue}",ENDITEM,

Actual: "Name = Hello ", Value ={TempValue}",ENDITEM,

 

missing a quote? Give that a try. If this resolves your issue can you marked it as solved.

 

To tell somebody that they are wrong is called criticism. To do so officially is called testing.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

One further inspection it write out {TempValue} because that is the value stored in TempValue param.

 

I'm not sure what your trying to capture in the parameter but won't this work? It looks like you are hardcoding your param to be 1.01?

 

 lr_save_string("1.01", "TempValue");

 lr_output_message( "The value of {TempValue}=%s", lr_eval_string( "{TempValue}" ) );

 

web_submit_data("Test",
  "Action = XX",
  "Method =XX ",
  "TargetFrame=",
  "RecContentType=text/html",
  "Referer=XX",
  "Snapshot=XX",
  "Mode=HTML",
  ITEMDATA,
  "Name = Hello ", "Value ={TempValue}",ENDITEM,
  LAST);

To tell somebody that they are wrong is called criticism. To do so officially is called testing.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

and another method:

 

  float AmountTobeTransf;
 char TempValue[256];
 AmountTobeTransf = 1.01;
   
 lr_param_sprintf("TempValue","%.2f",AmountTobeTransf);


 lr_output_message( "The value of {TempValue}=%s", lr_eval_string( "{TempValue}" ) );

To tell somebody that they are wrong is called criticism. To do so officially is called testing.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

Leslie

 

Thanks for the reply .

It was my typo mistake in the quote issue  while posting in the forum.

 

Now I am able to assign using (lr_param_sprintf) and print the value in the lr_output_message .

 

But the actual problem is during the web_submit_data ,the value is not getting passed . I can see that the field in the page is having the text 'tempvalue' instead of 1.01

 

So still me looking for some help

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

you are using

lr_something. that always needs lr_eval

because they are LR parameter

 

you need to put string only which does not require eval

 

sprintf("TempValue","%.2f",AmountTobeTransf);

 

 

 

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

Please see the below complete code for your issue. In your code web_submi_data  quotes are missing before Value keyword. Because of that you were still getting TempValue instead of 1.01.

 

 

 float AmountTobeTransf;

  AmountTobeTransf = 1.01;

 lr_param_sprintf("TempValue","%.2f",AmountTobeTransf);

 

web_submit_data("Test",
     "Action = XX",
     "Method =XX ",
     "TargetFrame=",
     "RecContentType=text/html",
     "Referer=XX",
     "Snapshot=XX",
     "Mode=HTML",
     ITEMDATA,
     "Name = Hello ", "Value ={TempValue}",ENDITEM,
     LAST);

 

Thanks,

Pathan

 

If you find that this post resolves your issue, please be sure to mark it as an accepted solution

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

That Helped. Thanks !!

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Unable to Substitute value in the ITEMDATA variable

Jump to solution

It was missing a double quote in lr_param_sprintf..Thanks .That helped

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.