2 Replies Latest reply on Jul 1, 2011 8:50 AM by philmodjunk

    Create Variables Dynamically



      Create Variables Dynamically


      I need to create as many local variables in a script for data transfer as there are fields in a recurring import. Is there a scripted code that will let you create variables in a loop sequence without dialog?

        • 1. Re: Create Variables Dynamically


          Ya its possible with the help of Looping

          just follow below the steps

          set variable($x,Value:0)


          set variable($x,Value:$x+1)

          exit loop(if $x>ur required condition)

          set variable($VarNm,Value:Value: "$$VarNm" & $x).

          $$VarNm is the actually dynamic variable that are going to set on each step.

          here u can set each variable's value on ur requirment.


          Try it  i think it gives u the result.


          • 2. Re: Create Variables Dynamically

            You might want to use a Variable in array format for this by putting each value in a different repetition of the same variable or in a list.

            But capturing the field names and values in the first place won't necessarily be easy. I think I need to read your other post on that subject to see what you need to do there before going into more detail.

            PS. if your really do want to create variable dynamically, it can be done, but it's not trivial nor is the code needed to then extract the code using an indirect reference once it's done as the script won't know the names of these variables either. Setting up a list or array of values in the same variable will be much simpler to work with.