Unable To Display Content of Custom User Data in a Form

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

Unable To display Custom User Data in a Form.pdf (412 KB)

Hi Yaw,

Your setup looks correct to me. A couple suggestions that may help:

  1. Make sure your user is synced
  2. Make sure App Preview is using the most up to date version by clicking
    the white refresh button at the bottom of the tablet frame. When you see
    that red dot next to the update version it signals you are not using the
    most up-to-date version
  3. Instead of using if(count (/data/value) > 0, /data/value, "Unknown") you
    can use `coalesce(/data/value, 'Unknown') to achieve the same more cleanly.
  4. If the problem persists after above, please report a bug
    https://confluence.dimagi.com/display/commcarepublic/Bug+Reports so we
    can take a closer look.

Cheers,
Will

··· On Sat, Apr 29, 2017 at 10:49 AM, YAW ANTWI-ADJEI wrote:

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,
Thank you for your assistance.

Not sure what I did but after restarting my machine it worked. I shall
prefer the coalesce function so let me change it and see what happens.

  1. But why can't we assign it to the Hidden Value with the IF & COUNT, or
    COALESCE functions?

  2. Can I use the COALESCE function when I want to use Custom User Data as a
    Display Condition?

Yaw

Hi Yaw,

Your setup looks correct to me. A couple suggestions that may help:

  1. Make sure your user is synced
  2. Make sure App Preview is using the most up to date version by clicking
    the white refresh button at the bottom of the tablet frame. When you see
    that red dot next to the update version it signals you are not using the
    most up-to-date version
  3. Instead of using if(count (/data/value) > 0, /data/value, "Unknown") you
    can use `coalesce(/data/value, 'Unknown') to achieve the same more cleanly.
  4. If the problem persists after above, please report a bug
    https://confluence.dimagi.com/display/commcarepublic/Bug+Reports so we
    can take a closer look.

Cheers,
Will

··· On 30 Apr 2017 12:00, "William Pride" wrote:

On Sat, Apr 29, 2017 at 10:49 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  1. You can use either - they'll do effectively the same thing in your case
  2. Not sure exactly what you mean, but yes, you can use the coalesce
    function and custom user data in display conditions
··· On Sun, Apr 30, 2017 at 2:59 PM, YAW ANTWI-ADJEI wrote:

Hi Will,
Thank you for your assistance.

Not sure what I did but after restarting my machine it worked. I shall
prefer the coalesce function so let me change it and see what happens.

  1. But why can't we assign it to the Hidden Value with the IF & COUNT, or
    COALESCE functions?

  2. Can I use the COALESCE function when I want to use Custom User Data as
    a Display Condition?

Yaw

On 30 Apr 2017 12:00, "William Pride" wpride@dimagi.com wrote:

Hi Yaw,

Your setup looks correct to me. A couple suggestions that may help:

  1. Make sure your user is synced
  2. Make sure App Preview is using the most up to date version by clicking
    the white refresh button at the bottom of the tablet frame. When you see
    that red dot next to the update version it signals you are not using the
    most up-to-date version
  3. Instead of using if(count (/data/value) > 0, /data/value, "Unknown")
    you can use `coalesce(/data/value, 'Unknown') to achieve the same more
    cleanly.
  4. If the problem persists after above, please report a bug
    https://confluence.dimagi.com/display/commcarepublic/Bug+Reports so we
    can take a closer look.

Cheers,
Will

On Sat, Apr 29, 2017 at 10:49 AM, YAW ANTWI-ADJEI <yawantwiadjei@gmail.com wrote:

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,
Thank you very much. It was rather the App Preview that was not using the
latest version.

Can I use Custom User Data to determine which form(s) to be displayed. For
instance if user is a doctor, then Consulting room register must be
displayed on the Module Menu but not Patient Registration Form.

Yaw

Hi Yaw,

Your setup looks correct to me. A couple suggestions that may help:

  1. Make sure your user is synced
  2. Make sure App Preview is using the most up to date version by clicking
    the white refresh button at the bottom of the tablet frame. When you see
    that red dot next to the update version it signals you are not using the
    most up-to-date version
  3. Instead of using if(count (/data/value) > 0, /data/value, "Unknown") you
    can use `coalesce(/data/value, 'Unknown') to achieve the same more cleanly.
  4. If the problem persists after above, please report a bug
    https://confluence.dimagi.com/display/commcarepublic/Bug+Reports so we
    can take a closer look.

Cheers,
Will

··· On 30 Apr 2017 12:00, "William Pride" wrote:

On Sat, Apr 29, 2017 at 10:49 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yes, please see the documentation here
https://confluence.dimagi.com/display/commcarepublic/Form+Display+Conditions
.

Cheers,
Will

··· On Mon, May 1, 2017 at 3:40 PM, YAW ANTWI-ADJEI wrote:

Hi Will,
Thank you very much. It was rather the App Preview that was not using the
latest version.

Can I use Custom User Data to determine which form(s) to be displayed. For
instance if user is a doctor, then Consulting room register must be
displayed on the Module Menu but not Patient Registration Form.

Yaw

On 30 Apr 2017 12:00, "William Pride" wpride@dimagi.com wrote:

Hi Yaw,

Your setup looks correct to me. A couple suggestions that may help:

  1. Make sure your user is synced
  2. Make sure App Preview is using the most up to date version by clicking
    the white refresh button at the bottom of the tablet frame. When you see
    that red dot next to the update version it signals you are not using the
    most up-to-date version
  3. Instead of using if(count (/data/value) > 0, /data/value, "Unknown")
    you can use `coalesce(/data/value, 'Unknown') to achieve the same more
    cleanly.
  4. If the problem persists after above, please report a bug
    https://confluence.dimagi.com/display/commcarepublic/Bug+Reports so we
    can take a closer look.

Cheers,
Will

On Sat, Apr 29, 2017 at 10:49 AM, YAW ANTWI-ADJEI <yawantwiadjei@gmail.com wrote:

​Hello Commcare Users,
I want to know if it is possible to display the content of a Custom User
Data in a form using a Label Question and if Yes, how it should be done?

As per the attached, I have created Custom User Data Fields and Assigned
them to Hidden Values in a form.

Figure 1: Shows that when a user logs in the Custom User Data fields are
populated.

Figure 2: The first 4 questions are Label Questions I have used just to
Display the Content of the Custom User Data such that the Mobile User knows
that it is his/her facility details

Figure 3: This shows the results of the Label Questions. It is rather
outputting the ELSE part of the IF statement.

Any reason why this is so?

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.