3 Replies Latest reply on Dec 11, 2016 12:23 PM by beverly

    Converting Sql result to individual variables?


      Is there a way to get SQL to return both the field name and the value? 


      I'm working on a series of scripts that will pull information for a new record using ExecuteSQL.  I have fields defined to get their initial value from a variable, $fieldname.   What I would like to do is have a way to generate a variable from the field name and the value returned from the sql.


      Current method is somewhat fragile the sql returns a number of field values.  I use substitute with the field separator to turn this into a list of values.  then use a set variable statement to  turn the  list into individual variable using getValue.


      Programming this is a bit on the tedious side and prone to errors if I put the wrong number in the getvalue statement.  If I could get the field name and the value paired up in the sql result,  I might be able to use evaluate or the # and #assign custom functions from FileMaker Standards.org to automate this process.


      Thanks in advance for suggestion on this.