Assign DE value from an existing event to a new event (tracker)

Hi, let me bring us back to this question please.

I am trying to assign the same value from an existing event in Tracker capture to a new event. Even thou the value is the same, the data elements are different. For example in event A the data element is City and in Event B the data element is Town. I’ve tried the d2:hasValue(‘City’) expression and assigned #{city} to Town in my action but I seem to be missing something (I was thinking it is that simple).

Looking forward to a response.

Hi @Tangy , welcome to the community! :tada:

Did you try d2:hasValue('City') == true && #{City} == ‘City’?

Thanks!

Hi Addin

Let me try that and I will that and I will get back possibly with a solution

1 Like

I don’t quite fully understand what we are trying to achieve with #{City} == ‘City’ if this is to be part of my rule expression

This looks like I already have a value for City? Or please help me understand because if I am to copy your suggestion in the end my expression will be
d2:hasValue(#{City}) == true && #{City} == #{City} and my expression in action remains #{City}. Is that correct?

1 Like

You’re correct! So the idea would be if DE1 has a value assign that same value to DE2:
Expression: d2:hasValue(#{DE1}) == true
Action: assign value to #{DE2}

Make sure you clear the cache to be able to see the changes working correctly and not select a trigger only for one program stage because it needs to work across the different stages. You might also need to set a priority, it wasn’t working for me in the Child Program on play until I gave it a priority of 1.

Thanks!

1 Like

Thank you Addin, I will get back to you when I get a solution.

Hi Addin,

My validation rule seems to not be working

This is my expression rule: d2:hasValue(#{CM2.25}) == true
My priority is set to 3, because I quite have a few number of validation rules in this program.
I am assigning to cm3d.2
And, Expression to evaluate and assign I put: #{CM2.25}
I didn’t select a program stage like you suggested.

cm3d.2 is still empty and I expected it to have “Life” from cm2.25

Thank you

Hey

If you set the priority to 1 does it still not work? The rule is correct … do you see any errors in the Network tab? Did you clear the cache after creating the program rule and testing?

BTW, I’m also testing this and it seems to work differently when the first DE is in the registration form. The value will not be assigned to DE2 if the first DE is in the registration form until you edit DE1’s value again after registering.

Thank you!

It is still not working, I even tried assigning an actual value given that I know the value to the first data element. This error pop up how ever when I set the priority to 1, if I assign an actual value

image

Furthermore, Any assistance on the meaning of this? Maybe it is what is causing the rule4 not to trigger
image

It worked,

I just needed to change the source type in the program rule variable.

Thank you

1 Like

Good to know! Thanks for sharing!

What was the source type that didn’t work and which source type worked?

Data element in current event isn’t working
Data element from the newest event in the current program worked.

2 Likes

Thank you, this has been helpful

1 Like