Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load a field into different fields conditional on another field value

I have 1 field to load into 2 possible fields based on the value of another field. Source field is f1, output fields are out1, out2, conditional field is c1. Here's what I'd like to happen:

If c1 = 1, load f1 as out1, load f1 as out2

if c1 = 2, load f1 as out1

if c1 = 3, load f1 as out2

if c1 =4, load f1 as out2

I tried using a pick statement like this:

if(c1=1,f1) as out1,

[f1] as pick(c1, 'out1','out1','out2','out2')

but the pick statement breaks.

Any thoughts?


MB

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

if(match(c1,1,2),f1) as out1,
if(match(c1,1,3,4),f1) as out2,

View solution in original post

3 Replies
johnw
Champion III
Champion III

if(match(c1,1,2),f1) as out1,
if(match(c1,1,3,4),f1) as out2,

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can't use a conditional for the fieldname. Every row will have both an out1 and an out2. Your conditional will be for the value of those fields.

if( match(c1, '1', '2'), f1, '') as out1,

if( match(c1, '1', '3', '4'), f1, '') as out2

I think that's the right idea.

-Rob

Not applicable
Author

Thx - works perfectly.