Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
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'
  )
)