![]() |
|
Fetching value of variable from one action to another - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: Fetching value of variable from one action to another (/Thread-Fetching-value-of-variable-from-one-action-to-another) |
Fetching value of variable from one action to another - khairwal - 06-16-2010 Hi, we have one variable like 'irow' in action1 we need to fetch the value of that variable into another external actions (action2,action3 etc) called in same action1..Please guide.. RE: Fetching value of variable from one action to another - Saket - 06-16-2010 you can use action parameters or define this as environment variable. also you can define the variable public in a library file. RE: Fetching value of variable from one action to another - khairwal - 06-16-2010 We tried it buts itsnot working..we define the variable in a library file...buts its notrpicking values in other actions..can you pls specify how we can define it public..? RE: Fetching value of variable from one action to another - Saket - 06-16-2010 is there any error you receive or simply the variable returns empty? did you add the library as resource? RE: Fetching value of variable from one action to another - khairwal - 06-16-2010 No error ..variable returns empty... Yes i add library as resource..Please check RE: Fetching value of variable from one action to another - Saket - 06-16-2010 Yes I have just checked and it works for me. try this and let me know if it works create a new library file - lib1 add statement - Public TestPublic Create a new test - "test1" add statement - msgbox TestPublic add library to resource Create a new test again "test2" add statement - TestPublic ="this is a public variable" call the test created earlier add library to resource RE: Fetching value of variable from one action to another - khairwal - 06-16-2010 It works ..Saket...thanks for the help.. RE: Fetching value of variable from one action to another - khairwal - 06-16-2010 Hi Saket, That problem resolved now we have another issue...we need to increment the value of variable..like in first go its 2 in all actions , in second go it should 3 in all actions ...but as we specify it in library file its increments only in main action for rest it picks same value...pls advice... RE: Fetching value of variable from one action to another - Saket - 06-17-2010 It should be working, I will take the same example again in main script (Test2) define TestPublic as 'TestPublic =1' in test1 add statement 'TestPublic =TestPublic +1' after message box create a new test add statement , msgbox TestPublic. add library as resource call this in your main script and run you will get the desired result, from the first action it will return 1 and from second will return 2 after incrementing it. |