How to define the variable in script that have stored in excel sheet using winrunner?

[In A1 field contains {Class:push button, lable:OK..}

In B1 field Contains OK = button_press(OK);

where OK contains the value of field A1

OK should act as a variable which has to contain value of field A1]

Answer1:

There is no need to define any variable that is going to use in the Testscript. We can just start using it directly.

So, if we want to assign a value to the dynamic variable which is taken from Data Table, then we can use the \"eval\" function for this.

Example :

eval( ddt_val(Table,\"Column1\") & \"=\"water\";\" );

# The above statement takes the variable name from Data table and assigns \"water\" as value to it.

Answer2:

Write a function that looked down a column in a table and then grabbed the value in the next cell and returned it. However, We would then need to call.

button_press(tbl_convert(\"OK\"));

rather than

button_press(\"OK\");

where tbl_convert takes the value from the A1 (in our example) and returns the value in B1.

One other difficulty we would have would be if we wanted to have the same name for objects from different windows (e.g., an \"OK\" button in multiple windows). We could expand our function to handle this by having a separate column that carries the window name.