Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Use IF THEN ELSE statement in Attach Data Action

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 3

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

View solution in original post

2 Replies

Avatar

Employee

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. 

Avatar

Level 2

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 

Avatar

Correct answer by
Level 3

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