3 Replies Latest reply: Jul 16, 2012 12:35 PM by 885642 RSS

    Populating List with Instances

    897892
      Hi All,

      Is it possible to populate results of a dropdown list with entity instance names.

      e.g. I instantiate 4x instances of the child's name as part of the Children entity.
      HARRY
      BARRY
      SALLY
      LARRY
      Then on a seperate screen, I would like a dropdown list to be populated by Children's name.

      e.g.
      I may have a question:
      what is your favourite child (which is a drop down showing 4 instance names (HARRY,BARRY,SALLY,LARRY)
      I'm on v10.1


      Cheers
        • 1. Re: Populating List with Instances
          Ben Rogers
          Hi,

          There is a way to do this out-of-the-box but it all depends on your data model.

          I'm assuming here you have 2 entities, the person and the child. The child has an attribute called "the child's name".

          Create a one-to-one relationship between the person and the child, and call it "the person's favourite child"...

          Next, create a person-level question screen. Add a "relationship input" control to this question screen. For the "caption", write something like "please choose your favourite child". For the "display attribute", choose the child's name.

          This will display the question exactly as you want - it will ask the user to select from a drop down list of all the children.
          Of course, if the person can have many favourite children, create a one-many relationship. However, this will display the children's names as checkboxes, since the user is now allowed to select more than one.

          If the relationship is just a one-to-one, you can then use this relationship to access the favourite child's name on person level (using InstanceValueIf), or you could run rules which only apply to the favourite child.

          This is just one suggestion which Ive just tested in 10.3, I don't have 10.1 to hand at the moment but can't remember this being a brand new thing (others, please correct me if I'm wrong). Give it a go, see if it works and get back to me if it doesn't. If it doesn't work on 10.1 you should certainly consider upgrading to 10.3 for a whole host of other reasons too. Failing that, this is implementable with a custom control.



          Cheers,
          Ben

          Ben Rogers
          Senior Consultant - Monad Solutions
          http://www.monadsolutions.com
          • 2. Re: Populating List with Instances
            Ben Rogers
            Hi,
            Just double-checked with someone running 10.1 - this solution also works in that version...so no custom controls will be needed.

            Hope this answers the question, do post back if you have any difficulties.

            Thanks,
            Ben

            Ben Rogers
            Senior Consultant - Monad Solutions
            http://www.monadsolutions.com
            • 3. Re: Populating List with Instances
              885642
              This functionality works fine when implementing on a 'flat' screen. However we have a requirement where we want to use this functionality on an entity collect screen (i.e. several instances of the person would require several additional screens to capture the favourite child for each. We'd rather be able to do this on just the entity collect screen). I don't think this is possible as we have tried and the rulebase errors. Has anybody had any experience of this or maybe have any suggestions?

              Cheers.