Is there a way to create a concatenated variable name in lotusscript? I want to use the same name in a loop, only changed by the iteration e.g. variable_1, variable_2 etc. Where 1, 2 etc is the iteration i or whatever.
Subject: I suppose you could use Execute…
if they are global variables.
But, why would you want to do such a thing? Have you not heard of arrays?
Subject: Using array, of course
Thanks for your prompt answers! Wanting to collect data from different fields I just didn’t think of arrays. Not very used to lotusscript. Thanks for your push in the right direction, array worked just fine.
Subject: describe why and what you would do with it
There might be several solutions: Arrays or Lists might be what you want.Arrays must be defined (Dim or Redim) and List Lists not:
Dim varArray(100) as string
Dim varList List as string
for inX = 1 to 100
varArray(inX) = “xx”
varList(inX) = “xx”
next
Subject: Re: Variable Name
If you are trying to get at fields in a document that are called variable_1, variable_2, etc., then use this:
For i = 1 to someNumber
set item = document.GetFirstItem(“variable_” & Cstr(i))
x = item.Values(0)
etc.
Next