![]() |
| |||||||
Testing Anywhere Post messages and questions related to Testing Anywhere here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
I need to assign a database query to a variable, but I also need to use a variable in the database query, so: variable1 = select (columnName) from (tableName) where (columnName) = variable2 I can't create a new Local Variable to perform the query as the 'read from database' type does not allow you to use a variable in the query string. I can use a variable inside a query string in the Applications -> Database 'SQL Query', so I am half way there. But I can't find a way to assign this result to another variable. How can I perform this relatively simple action? Thanks. |
| |||
|
I could ask this another way (please also suggest a solution to the above problem): How do I assign the result of a Database 'SQL Query' to a variable? What I am trying to do is convert a numerical month (eg 1, 3, 11 etc) into its 3-character version (eg Jan, Mar, Nov). TA does not output a date in the format I need so I have a table with two columns, numerical date and 3-character date. I am then attempting to perform a lookup on the table for the numerical date (eg 3) and return the 3-char date (eg Mar). I then need to use the 3-char date in an application that only accepts dates in that format. Quite a long-winded method just to enter a date, but seems the best process. Just can't get TA to actually perform these actions... |
| |||
|
Any suggestions to the general question of how to assign the result of a database query to a variable?: variable1 = select (columnName) from (tableName) where (columnName) = variable2 Should be a simple operation but does not seem to have a simple answer. Thanks. |
| |||
|
I guess another question is what is the point of the 'Database SQL Query' function if the Select statement in the SQL can't be used to test for a result? Is there any way useful way to use the result returned from the SQL Select statement? |
| |||
|
Hi, yes I am aware I can export to external files, but it adds unnecessary complicaiton and points of failure to the test. It would make much more sense to keep the results internal to TA. Otherwise every iteration of the test will perform the SQL query, export it to some file, open/read the file, use the value, then have to close without saving the CSV file. All very cumbersome when it could be simply managed internally. |
![]() |
| Thread Tools | |
| Display Modes | |
| |