Trying to use Switch in an email body template to load one of several images but failing

I am trying to select from one of 8 images in an email body template. The switch reads a value from the row generated by the form, but I want to select one of the images from only the first row in the sheet, as otherwise all 8 images would have to be loaded every time.

The switch statement doesn't work successfully, either the email automation doesn't happen, or if it does, it ignores the switch.

See below for the template code and the sheet layout.

Grateful for any help!
James

Template.jpgSheet.jpg

Solved Solved
0 4 198
1 ACCEPTED SOLUTION

Oh this was solved by using a thisrow argument:

<<Start: SELECT(PlrTest[ID],[ID]=โ€6f711588โ€)>>
<<SWITCH([_THISROW].[ImageSelect],
1, [Image1],
2, [Image2],
3, [Image3],
4, [Image4],
5, [Image5],
6, [Image6],
7, [Image7],
8, [Image8],
""
)
>>
<<End>>

View solution in original post

4 REPLIES 4

I'd be grateful if you could point out the error? I can't see that it's wrong, the first value is numeric, then it should choose the column value?

So the correct format should be
SWITCH(expressioncase1value1, [case2value2 ...], default)

And I have
SWITCH(ImageSelect],1,[Image1], etc ... ""

ImageSelect column is of type Number.
1, 2, 3 etc are numeric values.
Image1 is the column containing the image that should load in the template?

Oh this was solved by using a thisrow argument:

<<Start: SELECT(PlrTest[ID],[ID]=โ€6f711588โ€)>>
<<SWITCH([_THISROW].[ImageSelect],
1, [Image1],
2, [Image2],
3, [Image3],
4, [Image4],
5, [Image5],
6, [Image6],
7, [Image7],
8, [Image8],
""
)
>>
<<End>>

SWITCH([Image Select],"Image 1",[Image 1],"Image 2",[Image 2]...,[Default Image])

In other words

IFS(
[Image Select]="Image 1",
[Image 1],
  [Image Select]="Image 2",
[Image 2],
...
TRUE,
[Default Image]
)
Top Labels in this Space