I understand For loops, but I'm struggling trying to set n SET variables.
Basically, what I'm trying to do is for each @i
in a rowset, I'm trying to:
SET @SegLocator
(and concatenate @i
to the end) for each one I find, so that I can compare @SegLocator1
to @SegLocator2
.
I'm good on looping, and concatenating, I'm just not clear on how to increment a new SET @SegLocator
. I know the script below isn't valid, but it doesn't appear that I can do something like:
%%[if not empty(FlightSegmentInfo) then
for @i = 1 to Rowcount(@rowsetSegLocator) do
SET @SegLocator(@i) = Field(Row(@rowsetSegLocator,@i),1)
]%%
%%=v(@SegLocator(@i))=%%<br/>
%%[Next @i]%%
%%[endif]%%
Is there a way to dynamically create a NEW set var based on an unknown number of rows?
I've also tried variants of the following:
%%[if not empty(FlightSegmentInfo) then
for @i = 1 to Rowcount(@rowsetSegLocator) do
SET (concat(@SegLocator,@i)) = Field(Row(@rowsetSegLocator,@i),1)
]%%
%%=v(concat(@SegLocator,@i))=%%<br/>
%%[Next @i]%%
...and...
%%[if not empty(FlightSegmentInfo) then
for @i = 1 to Rowcount(@rowsetSegLocator) do
SET (concat("@SegLocator",@i)) = Field(Row(@rowsetSegLocator,@i),1)
]%%
%%=v(concat("@SegLocator",@i))=%%<br/>
%%[Next @i]%%
...and finally...
%%[if not empty(FlightSegmentInfo) then
for @i = 1 to Rowcount(@rowsetSegLocator) do
SET @(concat("SegLocator",@i)) = Field(Row(@rowsetSegLocator,@i),1)
]%%
%%=v(@(concat("SegLocator",@i)))=%%<br/>
%%[Next @i]%%