RobMac Posted February 8, 2008 Share Posted February 8, 2008 I dont know the correct terminology for this so maybe not finding it in my searches. I am trying to build a query based on settings I put in the first line of a tab delimited file. Then based on these settings and terms I want to run through the rest of the lines to actually run the queries. So basically my question is how can I store a set of text and variable names in a string variable then later "use it" and have the variables inline be evaluated and replaced with their values. I know how to do everything besides creating a string with variables that will later evaluate to replace variables with values. Example: If my top row from my input file was: ( 1 and ( 2 or 3 or 4 ) . I would want to create a variables that says: "( $instring[1] and ( $instring[2] or $instring[3] or $instring[4] )" (Obviously if this line was different I would want to create a different arangement of variables for the query string). Then when these values are read in from later lines: Fruit apple pear peach Vegetable carrot tomato squash Should turn into: ( Fruit and ( apple or pear or peach ) ( Vegetable and ( carrot or tomato or squash ) Thanks as always for any help. -Rob Link to comment Share on other sites More sharing options...
SadBunny Posted February 8, 2008 Share Posted February 8, 2008 (edited) How about... $sMyString = "( " & $instring[1] & " and ( " & $instring[2] & " or " & $instring[3] & " or " & $instring[4]) " Edited February 8, 2008 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 (edited) Eval() Dim $a_b = 12 $s = Eval("a" & "_" & "b"); $s is set to 12 Edited February 8, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
RobMac Posted February 8, 2008 Author Share Posted February 8, 2008 Thanks I guess I should have trusted my choice of "evaluate" as the term describing what I wanted to do and searched on that. Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 (edited) Thanks I guess I should have trusted my choice of "evaluate" as the term describing what I wanted to do and searched on that.You are welcome in AutoIt's world :-)Answers for 99% of all questions are in AutoIt helpfiletrust me I know what I'm talking about because I read it :-)) Edited February 8, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now