Intelligent Automation & Macro Software  

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

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2010, 06:43 AM
catchem35 catchem35 is offline
Junior Member
 
Join Date: Nov 2009
Posts: 11
Default Script to read multi line MySQL Query to single string variable

When using MySQL Queries that are read from text files, AA requires the Queries to be a single line in order to be read from text and then assigned to variable.

Example:
Variable = SELECT * FROM DATA.TABLE WHERE VALUE = X

This format is fine for a small query, but when using a query that is 80+ lines long the resulting query in a single line string is very difficult to read and work with.

Is it possible to write a script that would read a formatted text file and convert it to a single string that would be recognized by AA? By formatted I only mean that the text file has lines terminated by a CR & LF but is still in plain text format.

Example:
Select * from DATA.TABLE
WHERE VALUE = X


And convert those two lines (or any number of lines) in to a single string?

I would think this is possible with VB Script by stripping out the CR & LF characters and replacing them with a space. I don't know how to write the script but I do appreciate any help that can be offered. Thank you.
Reply With Quote
  #2 (permalink)  
Old 07-07-2010, 03:43 PM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

In such case, we can create a stored procedure that would include the entire 80 + lines query in required format and can execute that procedure using 'Run Stored Procedure' command.
Reply With Quote
  #3 (permalink)  
Old 07-21-2010, 07:41 AM
catchem35 catchem35 is offline
Junior Member
 
Join Date: Nov 2009
Posts: 11
Default

MySQL won't allow the use of "LOAD DATA" in stored procedures.
Reply With Quote
  #4 (permalink)  
Old 07-22-2010, 07:20 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

In that case, you can read the formatted query from text file using 'Read from Text/CSV file' command and using string operation command replace CR & LF characters with a space into any user variable. This user variable can then be used with SQL Query command.

Hope this helps.
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 07:35 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