Ask a Question

Script-How to call a stored value at the project variable in a list

saranoor
Frequent Contributor

Script-How to call a stored value at the project variable in a list

Script-How to call a stored value at the project variable in a list

I am writing a small script.

I am creating a report which generates areport number.

I am storing the value (report number) in a global variable declared at the project level .

I need to identify that report number from a list of reports and click on the report number which is a hyperlink.

 

function foo(){
var itemCount = Aliases.browser.pageUntitledDocument.table;
Sys.Browser("iexplore").Page("http://fred01/index.cfm?fuseaction=MEDFR.OneProject&key=28942 &stid=1&apid=2").Table(1)
var test1 = itemCount.FindChild("text",Project.Variables.MedferReportNumber,5);
test1.DblClick();
}

 

I had succesfully written a script in my earlier test.  

Script running succesfully is as below.

 

function foo(){
//Project.Variables.NewWorkOrderID = 1605152
var itemCount = Aliases.EthelPCWpf.HwndSource_NavigationWindow.NavigationWindow.mWorkOrderList;
var test1 = itemCount.FindChild("text",Project.Variables.NewWorkOrderID,5);
test1.DblClick();

}

 

 

 

 

20 REPLIES 20
saranoor
Frequent Contributor

Adding screenshots 

Which part are you having trouble with?  Is the storing of the value or finding the correct line to click?

saranoor
Frequent Contributor

I think it is when I am tryingt o write the script to call the stored .variable

Try putting the variable value in the log.  Then you can see if it's getting the value you want or not.

saranoor
Frequent Contributor

Added some more screenshots.

I think the value is not getting stored in the global variable.

saranoor
Frequent Contributor

value is getting stored and that step is passing,.

now I need to understand how to tweak the script

 

function foo(){
var itemCount = Aliases.browser.pageUntitledDocument.table;
Sys.Browser("iexplore").Page("http://fred01/index.cfm?fuseaction=MEDFR.OneProject&key=28942stid=1&apid=2").Table(1);
var test1 = itemCount.FindChild("text",Project.Variables.MedferReportNumber,5);
test1.DblClick();
}

Hi,

 

> now I need to understand how to tweak the script

What's wrong with it?

 

What log shows up if you insert

Log.Message(Project.Variables.MedferReportNumber);

line of code right before the

var test1 = itemCount.FindChild("text",Project.Variables.MedferReportNumber,5);

one?

Also, if the 'text' property has a text value, what if you explicitly convert the value of MedferReportNumber variable to be of text type?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
saranoor
Frequent Contributor

Script is not working

"script is not working" gives us no details about your problem, so we can't really answer it

 

Tell us what happens when you try to run the script?  Do you get an error?  What is the message?  What have you tried in order to fix it and what happened then?

cancel
Showing results for 
Search instead for 
Did you mean: