Micro Focus QTP (UFT) Forums
help with a dynamic parameter - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: help with a dynamic parameter (/Thread-help-with-a-dynamic-parameter)



help with a dynamic parameter - guilherme_br - 03-18-2009

I'm facing a problem on my test that I'm doing for the company that I work for, I'll try to explain the best way possible.

In a specific page on the web site has a label that have a transaction authentication number, and as you might guess, it is a random number.

So far I know, I'll need to program a function to treat that. The web site will generate a random number, then I need to find that number on a table (maybe?) and fill the specified field with the correspondent code number from that random generated number.

The worse is that my knowledge on scripts in vb is very low, but I think with a code like that I'll resolve the problem.

If someone has some exemple similar to mine, I ask to give me a hand to solve this problem.

Thanks in advance.


RE: help with a dynamic parameter - guilherme_br - 03-20-2009

Well, after so many tries, finally I did something to start to fix my problem:

Quote:set ex= CreateObject("Excel.Application")
Set a=ex.Workbooks.open("c:\Book3.xls")
Set b=a.worksheets("Sheet1")

dim fieldcheck, branch1, label

label = "Branch(three-digit)"

i=1

While (label <> fieldcheck)
fieldcheck=b.Cells(i, "A").value
If label = fieldcheck Then
branch1=b.Cells(i, "B").value
End If
i = i+1
Wend

Browser("...").Page("...").WebEdit("branch").Set branch1

I used a variable to store the label value on web site, then in while I search for the row that has the same value than label.

Now I need one more thing, The label that I have to compare has a value that changes everytime (i.e. "TAN No. xxx", where xxx is the varying number)

I don't know how to do that, I was thinking something about checkpoint that field. Or maybe a way to read that field on the site and assign the value to a variable and compare.


RE: help with a dynamic parameter - guilherme_br - 03-25-2009

Well, after many hours of searching on the internet I finally found how to hadle that error.

But now I have another, it's a stupid question but I don't know how to do that. In the QTP tables I need to put some dates to do some tests. But the site returns me other message because the sheet hide the zeros (I fill the sheet with "01" then the sheet "turn" to the number "1")

I found a way to do that open the sheet on excel and changing the number format to text.

There's another way to do that? I can't found in QTP an option to change the format to text.


RE: help with a dynamic parameter - sepgs2004 - 03-27-2009

Try putting the values in an Excel, format them to text, and import the excel into your datasheet. [Right-clicking on the datasheet gives an option to import]. I did not specifically try this myself... Just a thought.


RE: help with a dynamic parameter - guilherme_br - 03-30-2009

Thanks mate! I did that and it works. Another way it's fill the cell with '01 and also works. Big Grin