Expand my Community achievements bar.

SOLVED

Multiple If condition for Data prep

Avatar

Level 2

Hi,

in my project I need to write the event type field in my XDM schema using data prep on source attribute.

The problem is that, the condition are multiple.

For example :

iif(statuscode == 'open' && status == 'option' && isPostponed == 'false', 'newoption', 'undefined')

In the same flow I have other condition to write the same event type field:

iif(statuscode == 'open' && status == 'optioned' && isPostponed == 'true', 'optionextended', 'undefined')

How can I write a single condition?

 

Thank you very much.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @user36079 

I haven't came across such use case yet, but you can try nesting the second iif condition into first one.

 

iif(
  statuscode == 'open' && status == 'option' && isPostponed == 'false',
  'newoption',
  iif(
    statuscode == 'open' && status == 'optioned' && isPostponed == 'true',
    'optionextended',
    'undefined'
  )
)

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @user36079 

I haven't came across such use case yet, but you can try nesting the second iif condition into first one.

 

iif(
  statuscode == 'open' && status == 'option' && isPostponed == 'false',
  'newoption',
  iif(
    statuscode == 'open' && status == 'optioned' && isPostponed == 'true',
    'optionextended',
    'undefined'
  )
)