2 Replies Latest reply on May 16, 2013 10:15 PM by JFJoyal

    Dynamically retrieving values from fields

    JFJoyal

      Title

      Dynamically retrieving values from fields

      Post

           Hello; I have a set of fields named "field1 .... field147" and I want to retrieve their value dynamically. I'm able to create the variables dynamically, I used the followiing example that I found very helpful :

           http://www.supportgroup.com/explore/dynamically-naming-a-variable/

           However when it comes to getting the actual value in the fields I get the text string instead of that actual value ex. Imports:field & $n  gives me Imports:field1,Imports:field2 and so on as the script loops. I'm sure it just a syntax issue but I've been turning in circles trying to get this to work, any ideas. If this senario could work, it would save me the hassle of writing 147 Set Variable statements. Thank you.

        • 1. Re: Dynamically retrieving values from fields
          philmodjunk

               147 fields named like this suggests that you would be better off with a different data model--perhaps one with up to 147 related records of one field each instead of 147 different fields in one record.

               That said, the getfield function will allow you to indirectly reference a field.

               GetField ( "YourTableOccurrenceName::Field" & $n )

          • 2. Re: Dynamically retrieving values from fields
            JFJoyal

                 Thank you for your help. Actually the 147 fields are imports from an Excel workbook.  Within this workbook and the 147 fields which are answers to test questions, a lot of these fields are attributes to the questions so the actual data model has about 73 records with maximum 5 fields each. Which makes things a litlle more sound than 147 fields named field1,field2,field3..... Thanks again!