Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..
1806 views

Finding largest value from the list of values

Hello All,

I have a scenario .. where i need to capture all the rate card data and find the largest value (Select) and move to next page.

To find all the list of values i did correlation .. ord=all,i could see all the list of values in correlation parameter function.

Below is code where im facing an issue.

Please help me where im wrong.. 

//initilization

char arr[10];
int y[100][100];
int location=1, maximum;

//Storing values in array

n= atoi(lr_eval_string("{Correlation1_count}"));

for(i=1;i<=n;i++)
{
sprintf(arr,"{Correlation1_%d}",i);
sprintf(y[i],"%d",atoi(lr_eval_String(arr)));
}

//finding highest value from array
maximum = atoi(lr_eval_string(y[1]));

for(i=1;i<=n;i++)
{
if (y[i]>maximum)
{
maximum= y[i];
location =i+1;
}
}

 Thanks in advance.!!!!

Regards,

sai

0 Likes
5 Replies
Highlighted
New Member.

Re: Finding largest value from the list of values

Hi Sai,

Can you describe the problem you are facing with this code?  Are you facing compilation issues with this code?  Or something else?  How many chracters/digits does each rate card data have?

Thanks

GVR

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Finding largest value from the list of values

Hi ,

 

Please find the error screenshot.

My scenario is to find the rate card values .. which are integer and find the largest among the list and position of the value because a dynamic value related to that value which should be captured.....

 

 

0 Likes
Highlighted
New Member.

Re: Finding largest value from the list of values

maximum=atoi(lr_eval_string(y[1])); is an incrorrcet statment because lr_eval_string requires a parameter as an input to convert to a string.  It is throwing the error as y[1] is an integer. 

You declared 'y' as a 2-dimensional array of integers.  so, y[1] is an integer.  You can directly assign y[1] to 'maximum' variable as following.

maximum = y[1];

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Finding largest value from the list of values

I'm sorry for the late reply.. i was occupied by some other work.

Here is the response from which i need to pick the largest digit value and its respective dynamic value.

 Response body:

<div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80" name="challenger[order_selected]" type="radio" value="eUlCRnhkVSs5R0tqTG5obEZIWWEwdz09LS1USjdOdytuditQdmNoWE5LSkZpMDVBPT0=--3fb112e512edd2f77187705cbefeb5c479c85a80" /><label class="collection_radio_buttons" for="challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80">54</label></span></div>
<div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239" name="challenger[order_selected]" type="radio" value="dENnU2Ewd3dpTC8wL08ya0tkblhTZz09LS1IME5hQW5yenVFMjJDMFkyK3FzSE53PT0=--12dc0d52ba07f91b2957ce4a64aca7c812087239" /><label class="collection_radio_buttons" for="challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239">53</label></span></div>
<div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0" name="challenger[order_selected]" type="radio" value="ZC91djdXcXc3OXFlazgvaHQxNVBYZz09LS1McXVTRFp1dTRFUU1jYUNtRWpVcUZnPT0=--004c87cba6be163627a29ecf097145307e875ff0" /><label class="collection_radio_buttons" for="challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0">20</label></span></div>
<div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5" name="challenger[order_selected]" type="radio" value="djVLZnVtUytGVHhPN1IybnpOb1NWUT09LS1ZWTVFL2VPRFE0aWdKKzBnWHlCUmxRPT0=--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5" /><label class="collection_radio_buttons" for="challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5">244</label></span></div>
<div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22" name="challenger[order_selected]" type="radio" value="SHBjTUZ1ajZ5c0xuQXFUUTl0bzZWUT09LS1IeXJ0SVdlNUZBZHJTa2orYVg4UTVBPT0=--4bcb59d227c1658800f0c2a4d9ca70c59b002d22" /><label class="collection_radio_buttons" for="challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22">101</label></span></div>

lr_save_string("<div class=\"input radio_buttons optional challenger_order_selected\"><span class=\"radio\"><input class=\"radio_buttons optional\" id=\"challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80\" name=\"challenger[order_selected]\" type=\"radio\" value=\"eUlCRnhkVSs5R0tqTG5obEZIWWEwdz09LS1USjdOdytuditQdmNoWE5LSkZpMDVBPT0=--3fb112e512edd2f77187705cbefeb5c479c85a80\" /><label class=\"collection_radio_buttons\" for=\"challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80\">54</label></span></div><div class=\"input radio_buttons optional challenger_order_selected\"><span class=\"radio\"><input class=\"radio_buttons optional\" id=\"challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239\" name=\"challenger[order_selected]\" type=\"radio\" value=\"dENnU2Ewd3dpTC8wL08ya0tkblhTZz09LS1IME5hQW5yenVFMjJDMFkyK3FzSE53PT0=--12dc0d52ba07f91b2957ce4a64aca7c812087239\" /><label class=\"collection_radio_buttons\" for=\"challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239\">53</label></span></div><div class=\"input radio_buttons optional challenger_order_selected\"><span class=\"radio\"><input class=\"radio_buttons optional\" id=\"challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0\" name=\"challenger[order_selected]\" type=\"radio\" value=\"ZC91djdXcXc3OXFlazgvaHQxNVBYZz09LS1McXVTRFp1dTRFUU1jYUNtRWpVcUZnPT0=--004c87cba6be163627a29ecf097145307e875ff0\" /><label class=\"collection_radio_buttons\" for=\"challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0\">20</label></span></div><div class=\"input radio_buttons optional challenger_order_selected\"><span class=\"radio\"><input class=\"radio_buttons optional\" id=\"challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5\" name=\"challenger[order_selected]\" type=\"radio\" value=\"djVLZnVtUytGVHhPN1IybnpOb1NWUT09LS1ZWTVFL2VPRFE0aWdKKzBnWHlCUmxRPT0=--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5\" /><label class=\"collection_radio_buttons\" for=\"challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5\">244</label></span></div><div class=\"input radio_buttons optional challenger_order_selected\"><span class=\"radio\"><input class=\"radio_buttons optional\" id=\"challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22\" name=\"challenger[order_selected]\" type=\"radio\" value=\"SHBjTUZ1ajZ5c0xuQXFUUTl0bzZWUT09LS1IeXJ0SVdlNUZBZHJTa2orYVg4UTVBPT0=--4bcb59d227c1658800f0c2a4d9ca70c59b002d22\" /><label class=\"collection_radio_buttons\" for=\"challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22\">101</label></span></div>","final_string");

 

i tried above "C" code , but no luck. can somebody help me.

from the response 244 is the highest number and its respective dynamic value is "djVLZnVtUytGVHhPN1IybnpOb1NWUT09LS1ZWTVFL2VPRFE0aWdKKzBnWHlCUmxRPT0=--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5".

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Finding largest value from the list of values

hi,

did you find the solution, Am too stuck with same challangers 5 step program.

there were two ways to accomplish finding the lasrgest value one is either by writing program to sort or the largest value in the list has a pattern i.e. LB of the largest contains the Largest_order value which we can fetch in first step in cookies, But to accomplish the secong one i need to use parameter inside the coorelation, for eg:

web_reg_save_param("sqordernum", "LB=challenger_order_selected_{sqorder_1}\">", "RB=</label>", "Search=All","Ord=All", LAST);

Here sqorder_1 is my previous fetched dynamic value from cookies.

So it would be really helpful if you have solved this issue please email me the code to ajaybasu@gmail.com

Thanks

Ajay H P

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.