Build column name in expression from a value in a column

I have some numeric values in a virtual column, [ImageSelect] stored as 1,2,3,4, etc.

I want to use these in an expression to select a column name containing an image in a template. The columns are called Image1, Image2, Image3 and so on.

The expression needs to be built up as something like <<"image" & [[ImageSelect]]>> but I'm not sure of the correct syntax. Is this even do-able?

thanks for any help

James

Solved Solved
0 8 114
1 ACCEPTED SOLUTION

Something like..
<<SWITCH([ImageSelect],
1,[Image1],
2,[Image2],
etc.
)>>

View solution in original post

8 REPLIES 8

Unfortunately you are not able dynamically construct the column name. Though I haven't tested how it goes with the template, but I would assume the behavior is the same there as well.

Oh dear. Sigh. I suppose I can do some kind of switch that says basically if the column value is 1 then choose Image1?

You would need to use for example something like..
SWITCH([ImageSelect],
1,[Image1],
2,[Image2],
etc..
)

Yes, I follow the logic - it's the syntax I'm struggling with.

In the email template, is it meant to work like this:

SWITCH([ImageSelect],
1,<<[Image1]>>,
2,<<[Image2]>>,
etc.

 

Something like..
<<SWITCH([ImageSelect],
1,[Image1],
2,[Image2],
etc.
)>>

Oh thanks, I'll try it!

You're welcome!

I tried this code:

<<SWITCH([ImageSelect],
1,ANY(Image_Row_Slice[Image1]),
2,ANY(Image_Row_Slice[Image2]),
"")
>>

It emailed me a long string of url stuff instead of the image I wanted to select.

I'm trying to grab it from the slice, is my syntax wrong for that? Sorry for what must be fairly baby questions!

Top Labels in this Space