Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Testing Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Testing Anywhere Post messages and questions related to Testing Anywhere here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-23-2012, 06:15 PM
KMuller KMuller is online now
Member
 
Join Date: Dec 2010
Posts: 91
Default How do I assign a variable to a database query result?

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.
Reply With Quote
  #2 (permalink)  
Old 01-23-2012, 06:47 PM
KMuller KMuller is online now
Member
 
Join Date: Dec 2010
Posts: 91
Default

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...
Reply With Quote
  #3 (permalink)  
Old 01-30-2012, 02:25 PM
KMuller KMuller is online now
Member
 
Join Date: Dec 2010
Posts: 91
Default

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.
Reply With Quote
  #4 (permalink)  
Old 01-31-2012, 04:56 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

Hi,

At present nested variable operation is not supported in Testing Anywhere. We will take this query as a suggestion and bring it to the attention of our Engineering team.

Regards.
Reply With Quote
  #5 (permalink)  
Old 01-31-2012, 07:43 PM
KMuller KMuller is online now
Member
 
Join Date: Dec 2010
Posts: 91
Default

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?
Reply With Quote
  #6 (permalink)  
Old 02-15-2012, 05:34 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

Hi Karl,

You must be aware of this but you do have an option to export the query results to a csv.
Reply With Quote
  #7 (permalink)  
Old 02-19-2012, 03:24 PM
KMuller KMuller is online now
Member
 
Join Date: Dec 2010
Posts: 91
Default

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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 03:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved