Case name referencing

Hi Evereyone,

I am trying to reference a case property in a follow up form but for some reason the question pulls the case id rather than the case name, how can i fix please?

image

I need the Group name to show up and not the ID, the same way the Department and Commune are showing up. The group detail is a separate case list though

The field i need to reference is this:

but rather its referencing the Case ID field in the form

Hi Jay, what expression are you using which evaluates to the case ID? Regardless, given the ID, you should be able to use this expression to obtain the case name:

instance('casedb')/casedb/case[@case_id = ID_EXPRESSION]/case_name

Hi @Ethan_Soergel,

I actually wasn’t using any expression since i have the group name saved as a case property so i only referened it in the form but then it’s picking up the case ID.

The current expression i am working on is this:

instance(‘casedb’)/casedb/case[@case_type = ‘benibiz_training_group_new’][Case_Id = #form/name_and_date_group/group]

But haven’t gotten it right yet.

Should it be:

instance(‘casedb’)/casedb/case[@case_type = ‘benibiz_training_group_new’][Case_Id = #form/name_and_date_group/group_name]

@Ethan_Soergel

Should the expression be placed within my hidden field?

I believe this should be the expression:

instance('casedb')/casedb/case[@case_type = 'benibiz_training_group_new'][@case_id = #form/name_and_date_group/group_name]

That is, I changed Case_Id to @case_id. Your screenshot above includes curly quotes and , which I replaced with simple quotes '. That can sometimes happen if you copy/pasted from a rich text editor like Word or email. The “Lexical error” in your screenshot refers to that issue.

Hi Ethan,

Can you also tell me how i can pull the actual name of the group in the report? Right now in the survey the group name is being properly referenced but when i pull the data into excel or power BI, its the case id thats still showing up.

Please help.

The syntax keeps reverting

It looks like that case ID is being saved as the answer to that lookup table question, is that correct? You need a hidden value with the calculate set to:

instance('casedb')/casedb/case[@case_id = ID_EXPRESSION]/case_name

But instead of ID_EXPRESSION, drag and drop the lookup table question there.

Hi @Ethan_Soergel,

Thanks so much, this works well. I have also saved it as a case property and pulling that property in subsequent follow up forms so it makes sense to the end users of the data.

Can you also help me with another issue, i have submitted a ticket for it earlier today. It has to do with archiving forms. I archived all the forms in my surveys so that we could test the surveys with fresh data. The archived forms do not show up in a regular form data export but they still show up when i do an excel dashboard report.

Kindly assist.

That’s good to hear. One word of caution about saving the name as a case property. You’re saving the name at the time the form is filled out - it’s not a reference to the group case’s name. This means if the name is later changed, it won’t be updated on this case. The alternative is to save the group case ID instead, and look up the name every time. Depends on what’s more appropriate for your use-case.

I don’t have a good answer to your other question, sorry. Archiving forms is intended to hide them from reports and exports, not sure whether there’s a straightforward way around that.

Yes i am still pulling the case ids alongside the case names as well.

Thanks so much @Ethan_Soergel