Calling previously typed name(as an attribute on tracker program) on the form

Dear community,
@Gassim is there a way that I can write a program rule so that the name value would appear on other data elements? I am not sure the question is well structured but I can give an example here:

  1. name: Pacifique
  2. Pacifique phone number: +250899988
  3. Pacifique Gender: Male

as you can see here data elements are : name, Phone number and Gender, but after typing name, it’s value continues to appear on other DE,

Thanks
Pachat

Hi @Pacifique_Hategekima,
I understand that it’s possible to create a program rule that uses the function d2:concatinate(<object>,<object>,...) to assign the value to a Data Element, Tracked Entity Attribute (TEA), or Program Indicator. Does it specifically need to display like this, @Pacifique_Hategekima? How about making the values appear in the feedback widget then it’ll be much easier I guess.
I tried right now to create PR-variables for the TEAs and then the expression is d2:hasValue{A{FirstName}} && d2:hasValue{A{LastName}} then the program rule action would be assign to the TEA First Name:
d2:concatenate(A{Child-First-Name}, ’ ', A{Child-Last-Name})
And the same for the TEA Last Name. This was the idea but I wasn’t able to get it to work. Note, I only tried this on TEA and not DEs.

If I get to make it to work I will let you know! :+1:

Thanks!

1 Like

Hello dear Gassim,
did you have this working?
Thanks
Pachat

1 Like

@Pacifique_Hategekima it would work but in a different way than what you described:

  • First Name: user enters first name
  • Last Name: user enters last name
  • gender: user enters gender and triggers PR to concatenate (first and last name)
    so that after the rule triggers:
  • first name: first + last
  • last name: first + last

However, this too is wrong because we are changing the data values for each data element! I think another option is create one data element that will display all the concatenations:

  • data element shows every value entered: first + last + gender + phone number …etc
  • first
  • last
  • gender
  • phone

:slight_smile:

Thanks for the reminder!

Thanks, @Gassim I get you, actually I see that the problem is that data is stored in data element therefore changing it means different data element.
my preference would be to display whatever I want to display in a widget, the problem is that widget are not well visible in mobile app unless there is other way that widgets can be put on front page in mobile app.

Thanks,

Pachat

1 Like

So the purpose is to display the info to the user when they enter the info using the android Capture app? Would a Display Text action in a program rule make up for it? It will be visible on the screen. (:

yes, the purpose is to display the text to the user, is there the way this can be triggered at the beginning of data entry?
how can I trigger this?

Thanks
Pachat

Sorry @Pacifique_Hategekima when I tried it and it wasn’t working and then I went back to the docs. In a tracker program, it will display in form only for one case which is when the Pogram Rule is configured as “Trigger rule only for program stage.”

You are working on TEAs so I think Display Text won’t work as you expect; however, hopefully someone from @dhis2-android could help us!

Thanks! :+1:

1 Like

Hi @Pacifique_Hategekima,

@Gassim is sharing the correct information. If you want to use the widgets to display text or values (using program rules), those elements will be displayed in the Analytics tab and not in the form.

So I would suggest to use one or more data elements to assign the information.

1 Like