Viewing concepts on the UI

developers-forum
Tags: #<Tag:0x00007fb858fbfa50>

(Sameer Motwani) #1

Hey,

We came across a requirement where we had to create two concepts with different answers. But we want their names to be appear same on the UI. Is it possible to achieve this?

Example :

Concept Name : A-Question has answers 1,2,3

Concept Name A-Answer has answers d,e,f

We want both these concepts to appear on the ui as “A”. We tried using the shortname, but while saving the concept using API, it’s not allowed to make the short name preferred.

Please let us know if it can be achieved using any alternate approach?


(Wyclif Luyima) #2

My guess is that you would have to mark their respective names you wish to be printed as preferred, but I doubt if the inbuilt concept validation will allow you to have 2 different concepts to have duplicate names in the same locale therefore, this might not work. You could use the short names and display those on the forms.

But it leaves me wondering why you would want to have different concepts with duplicate names because that’s bad.


(Ellen Ball) #3

What UI are you using? htmlform? xform? bahmni?

If you are using htmlform, you have several easy choices. Likely the second solution will be easier:

  1. Two concepts with different concept names, but you can use any label on the form. See below for suggestions:

                 <label>
                     <uimessage code="pihcore.mentalhealth.title"/>
                 </label>
    
  2. One concept with 6 answers, but use different answers to the 2 questions:

<obs conceptId=“conceptA” answerConceptIds=“1,2,3” />

<obs conceptId=“conceptA” answerConceptIds=“d,e,f” />


(Sameer Motwani) #4

how can you view short names for a concept instead of a normal name on a htmlform?

We are doing this because of a requirement where two concepts have different answers but have the same name and we wanted to achieve that. So we thought we can create two names that are different using which we can distinguish between the concepts but on the user interface we can make them appear as same.


(Wyclif Luyima) #5

@sameermotwani11 I think Ellen has made a great suggestion, all you need to do is specify different labels on the form that are not concept names, that way, you don’t have to duplicate the names


(Wyclif Luyima) #6

I’ve updated my last response, it looks like you have 2 options from what @ball and myself are saying i.e.

  • Create one concept with several possible answers, and for each question on the form, you can specify a different label and subset of answers for the user to pick from.

  • Alternatively you could create 2 different concepts each with its unique name (don’t duplicate names please) and set of answers but you will have to use different labels for each question on the form.


(Andrew Kanter) #7

Lesson here is that two concepts never should have the same name if they mean different things. If it is just a matter of which answers apply to a particular concept in a particular setting, then one concept with a subset of answers driven from the UI is best. If they really are slightly different concepts but you want the caption to appear the same in the form, then simply changing the name in the HTML is easiest with two different concepts having two different answer sets.