Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fetching value of variable from one action to another
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
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..
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
you can use action parameters or define this as environment variable. also you can define the variable public in a library file.

Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
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..?
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
is there any error you receive or simply the variable returns empty?
did you add the library as resource?

Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
No error ..variable returns empty...
Yes i add library as resource..Please check
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
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

Reply
#7
Solved: 10 Years, 8 Months, 3 Weeks ago
It works ..Saket...thanks for the help..
Reply
#8
Solved: 10 Years, 8 Months, 3 Weeks ago
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...
Reply
#9
Solved: 10 Years, 8 Months, 3 Weeks ago
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.

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  reusable action called inside another reusable action in qtp ritugoyal 0 2,471 05-05-2010, 03:16 PM
Last Post: ritugoyal

Forum Jump:


Users browsing this thread: 1 Guest(s)