Use IF THEN ELSE statement in Attach Data Action | Community
Skip to main content
Level 2
October 19, 2021
Solved

Use IF THEN ELSE statement in Attach Data Action

  • October 19, 2021
  • 1 reply
  • 1261 views

Is it possible to use IF THEN ELSE statement in Attach Data Action? 

And how should it be formed in JSON Payload?

 

For example, will it be possible to create a Context data key with value x if eventId contains "top" or "middle" otherwise have value y.

 

Any help, will be much appreciated.

Thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by CaliseCheung

Hi,

   You may try to create separated rules for this case.

    One rule for "event.id" : "Something.blah.top.level".
    One rule for "date.value.middle.blah".

    Another one with two conditions negated (set logic type to Exception)

    e.g.
    CONDITIONS:

    NOT event.id contains top  AND NOT  event.id contains middle.

Thanks,

Calise
Mobile Engineer

1 reply

Adobe Employee
October 19, 2021

So it seems like instead of "Attach Data" you want to use the "Modify Data" action. Ahead of the ACTION you would want to put a condition on the event. Or use the Mobile Core TrackAction event as your trigger. 

dim21Author
Level 2
October 20, 2021

Hi Ivan,

thank you for responding.

 

I want to create a new Context data variable that it's value is dependant on the values of an existing Variable.

eg if "event.id" : "something.blah.top.level" or " data.value.middle.blah" then create a new context data variable "key" : "value"

otherwise "key" : "no_value"

 

Would that be possible?

How should it be written?

 

Thanks 

CaliseCheungAdobe EmployeeAccepted solution
Adobe Employee
October 21, 2021

Hi,

   You may try to create separated rules for this case.

    One rule for "event.id" : "Something.blah.top.level".
    One rule for "date.value.middle.blah".

    Another one with two conditions negated (set logic type to Exception)

    e.g.
    CONDITIONS:

    NOT event.id contains top  AND NOT  event.id contains middle.

Thanks,

Calise
Mobile Engineer