Search
Display results as :
Advanced Search
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
wouter
Posts : 4
Join date : 2013-08-18

two variables in one variable Empty two variables in one variable

on Sun Aug 18, 2013 3:23 am
Hi!

I'm trying to use two variables in one variable. It is possible to use a variable in the Value column. However, I can't use 2 variables to show the result.

The script (variables x and y being different numbers):

store | 1 | a
store | 5 | b
while | ${a}<${b}
storeEval | ${x}-${y} | difference${a}
storeEval | ${a}+1 | a
endWhile

Above is working fine. I'm able to get the different variables created when using the 'direct' name of the variable:
echo | ${difference1}

What I want is somthing like:
echo | ${difference${a}}

this doesn't work. I have tried different variations, but nothing I tried did the trick.

Does anybody know if somthing like this is possible in Selenium IDE?

thx!
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 34
Location : Denver, CO

two variables in one variable Empty Re: two variables in one variable

on Tue Aug 20, 2013 4:05 am
Try:
echo | ${difference}${a}
avatar
wouter
Posts : 4
Join date : 2013-08-18

two variables in one variable Empty Re: two variables in one variable

on Tue Aug 20, 2013 2:39 pm
I tried it and it gives back the two variables. Say 'difference' = 4 and 'a' = 3 then 
echo | ${difference}${a}
gives back: 43


What I want is to show the content of the variabe ${difference3} but using ${a} for the number.
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 34
Location : Denver, CO

two variables in one variable Empty Re: two variables in one variable

on Tue Aug 20, 2013 9:34 pm
I'm confused on what you are trying to do. 

The only thing I can think of having you add to your steps is:

storeEval | difference${a}| difference
echo  |${difference}

If that's not it, can you give me an example of what you want to show, given 'difference'=4 and 'a'=3
avatar
wouter
Posts : 4
Join date : 2013-08-18

two variables in one variable Empty Re: two variables in one variable

on Wed Aug 21, 2013 3:45 am
The extra step is something I did consider but didn't know what the step should look like. Your suggestion is not what I want. Your suggestion gives "difference3" as result.

What I want is the content of the variable 'difference3'. So, using the above script 4 variables are created (difference1, difference2, difference3, difference4). Each loop has different 'x' and 'y' values resulting in different sums say 10,20,30,40. That means the variables created contain:

difference1=10
difference2=20
difference3=30
difference4=40

I can get the content of the variables using:
echo | ${difference1}
echo | ${difference2}
etc.

What I'm trying to accomplish is using a variable for the number. like this:
store | 1| x
echo | ${difference{x}} {<-- this doesn't work)
echo: 10

I want this so I can make part of my script general. I now fixed it by adding an extra step to my script:
storeEval | ${difference1} | difference

inspired by your solution, so thank you ccox!!

I'm still curious though if what I want is possible.
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 34
Location : Denver, CO

two variables in one variable Empty Re: two variables in one variable

on Wed Aug 21, 2013 4:04 am
I get what you're saying now.  I'll see if I can think up a better solution.  I tried a few things, but am seeing what you are.
kashyap_guru
kashyap_guru
Active particpant
Active particpant
Posts : 24
Join date : 2013-10-16
Age : 32
Location : India

two variables in one variable Empty Re: two variables in one variable

on Thu Oct 17, 2013 11:24 am
Hi wouter,

You can use 2 variables at in single code as below.

storeEval | storedVars['difference${x}'] | difference

It will surely work as you need.

If it doesn't work, then please install STOREDVARS addon of selenium ide. Then try to run this. It will surely work.
avatar
wouter
Posts : 4
Join date : 2013-08-18

two variables in one variable Empty Re: two variables in one variable

on Thu Oct 17, 2013 6:56 pm
so simple Smile . Thx, this works!
Sponsored content

two variables in one variable Empty Re: two variables in one variable

Back to top
Permissions in this forum:
You cannot reply to topics in this forum