Highlighted
Absent Member.
Absent Member.
256 views

Using alternate link

My application is like Pension Portal, some of the users have pension data but some doesn't have. I have recorded the script for it but it fails for the users which does not have pension data & displays the page stating as for example “Please contact the company” & also it is marked as Failed Transactions & for that particular user, it stops testing the rest of the part. So, I am looking forward to use some alternate link say Home Page in the said case. So, is there any way to do this.
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

What you can do is check for the message and using that you can divert your flow to an alternate page.You can do it this way:

//Capture the message displayed in the screen, get the LB and RB and replace below
web_reg_save_param("MESSAGE","LB=....","RB=....","NotFound=Warning",LAST);

web_url(...............)//This is your page where there may or may not be pension data present

if(strcmp(lr_eval_string("MESSAGE"),"Please contact the company")!=0)
{//This means pension data is found and you do the required operations here
}
else
{
//Pension data is not found so you can put the web_url statement for the alternate link here
}

Let me know how it goes

Thanks
Prashanth Thimmavajjala

0 Likes
Highlighted
Absent Member.
Absent Member.

thanks for your reply.
but i was somewht confused in scripting

Below is the message I gets while error:
The system cannot calculate your benefit. Please contact call Center at 000-000-000 between the hours of 8 am and 8 pm IST, or click contact us to leave a message

Below is the script which I have created based upon ur suggestion:


lr_start_transaction("1_Calc_EstPension");
web_reg_find("Text=Pension Calculator ", "SaveCount=est_cnt",
LAST);
web_reg_save_param("MESSAGE","LB=The system cannot calculate your benefit ","RB= Please call","NotFound=Warning",LAST);
if(strcmp(lr_eval_string("MESSAGE"),"The system cannot calculate your benefit. Please contact call Center at 000-000-000 between the hours of 8 am and 8 pm IST, or click contact us to leave a message")!=0)
{//This means pension data is found and you do the required operations here
web_link("Estimate your pension",
"Text=Estimate your pension ",
"Snapshot=t1.inf",
EXTRARES,
"Url=images/pleasewait.gif", "Referer=http://abc/ibac.aspx?commandSet=DBEstimateLoadCommandSet", ENDITEM,
LAST);
}
else
{
// Pension data is not found so you can put the web_url statement for the alternate link here
web_link("My Data",
"Text=My Data",
"Snapshot=t2.inf",
LAST);
}
lr_end_transaction("1_Calc_EstPension",LR_AUTO);


So can u check & verify, where I am going wrong.

thanks again
0 Likes
Highlighted
Absent Member.
Absent Member.

Hello,

Your web_reg_save_param statement is wrong, your left and right boundaries are incorrect. I hope you understand the usage of WSRP statement, if not I suggest you to have a look at the help file once.

The WSRP statement will capture the data which is present in the server response of the request that is present between the LB and RB provided by you.

In your case,lets suppose you have something like this in your server response
ErrorMessage if no records found: The system cannot calculate your benefit. Please contact call Center at 000-000-000 between the hours of 8 am and 8 pm IST, or click contact us to leave a message.End of message.

Now your WSRP statement should have the "LB=ErrorMessage if no records found:" and "RB=.End of message.". The statement will now capture the entire message that is there between the boundaries which is the message you are interested in. Now, you can use the logic as before.

Thanks
Prashanth Thimmavajjala
0 Likes
Highlighted
Absent Member.
Absent Member.

I just noticed that something fundamental was wrong. your WSRP statement is not followed by a url request which is not the correct usage.

//Your WSRP statement here
//Your home page here where the records or the message is shown

//Compare logic to redirect accordingly to another page

Thanks
Prashanth T
0 Likes
Highlighted
Absent Member.
Absent Member.

What does message here indicates, does that mean that message window popups or what?
If this is the case, my system doesn't give popup window for message it simply displays that message on web page.
Can u do the needful?


Thanks
0 Likes
Highlighted
Absent Member.
Absent Member.

The message here refers to the message displayed in your screen only.Please read the function reference for web_reg_save_param for better understanding of the function and its usage.

Thanks
Prashanth T
0 Likes
Highlighted
Absent Member.
Absent Member.

Diqish,

You can put the condition using web_reg_find too.


Use the web_reg_find function as below and place at just before the step which cause this message to display

web_reg_find("Text=The system cannot calculate your benefit", "SaveCount=err_cnt",
LAST);

/* Here you action which causes the message to display */


If(strcmp(lr_eval_string("{err_cnt}"),"0")==0)

/* Message is not displyed. contiue with your flow */

else

/* Message is diplayed . click on homepage, exit the iteration and continue with next */


Thanks,
Jenny
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.