7 Replies Latest reply on Jan 19, 2011 12:30 AM by kc@dafolo.dk

    Variable containing a list of lists

    kc@dafolo.dk Level 1

      Hi all,

       

      In LC Workbench you can define a variable to be a list of lists. However what I have realized is that it does not seems to work as I expected.

       

      Scenario:

       

      I need a process that returns a list containing a number of elements that themselves are lists. I want to use this in a form to represent some type of structure in this form.

       

      I have created a process that with a list variable of strings (ChildList) and one variable which is a list of list (ChildGroup).

       

      I create and fill the ChildList and this works fine, however when I try to add my ChildList tol the ChildGroup I get a coercion exception like this:

       

      Cannot coerce object: Lisa Exampleson, 20000202-1231 of type: java.lang.String to type: interface java.util.List

       

      What I try to do in the set value step is the following:

       

      /process_data/ChildGroups[number(/process_data/@count)] = /process_data/ChildList

       

      So what I conclude from this is that my right side of this set value somehow is wrong.

       

       

      How can I add a variable of type list into another variable of type list?

       

      Thanks in advance

       

      Sincerely

      Kim Christensen

      Dafolo A/S

      Denmark

        • 1. Re: Variable containing a list of lists
          $$VIKS$$ Level 1

          Hi Kim,

           

              I don't think livecycle supports such complex types i.e. it does not support collection of collections. Eventhough workbench allows you to create such complex variables, you will not able use these in workflows as at assignments they will fail. I think your list can hold only simple type of data, in your case ChildList.

            If you could represent this List of List structure in xml format and define a xml schema for the samethen you can use this schema to define this structure in your form.

           

           

          Regards,

          Vik

          • 2. Re: Variable containing a list of lists
            kc@dafolo.dk Level 1

            Hi there Vik,

             

            I was afraid that this was the case.

             

            I have thought exactly the same thing that you are saying with an xml-variable, but haven't been able to achieve what I want.

             

            What I want is the form to fill out the fields one by one when I invoke the process, however when I invoke the process through the form I just get one field with all the xml structered in the way of the xml-schema, but I am not sure how I can take this xml and use it to fill the fields in my form.

             

            My XML structure is like the following:

             

            <root>

              <childGroup> (1- many)

                   <child/> (1-many)

              <childGroup>

            <root>

             

            I would like the form to be filled with groups of children grouped like the structure according to the xml I create in the process. How can I achieve this?

             

            Thanks in advance

             

            Sincerely

            Kim Christensen

            Dafolo A/S

            Denmark

            • 3. Re: Variable containing a list of lists
              $$VIKS$$ Level 1

              Kim,

               

                 I have attached a sample form, xsd and xml.

                Save all the files to your disk and open the form in designer (preview) to see if addresses your requirement?

               

              Regards,

              Vik

              • 4. Re: Variable containing a list of lists
                kc@dafolo.dk Level 1

                Hi again Vikram,

                 

                Thank you so much for your quick reply.

                 

                I cannot see the attachments in the post - can you try to repost them?

                 

                Thanks in advance

                 

                \Kim

                • 5. Re: Variable containing a list of lists
                  Jasmin Charbonneau Level 4

                  "  I don't think livecycle supports such complex types i.e. it does not support collection of collections."

                   

                  That's not totally true. I've never used List of Lists,but I've used Map of Lists and that worked.

                   

                  Jasmin

                  • 6. Re: Variable containing a list of lists
                    kc@dafolo.dk Level 1

                    Hi Jasmin,

                     

                    How did you manage to do this? I tried my self, however I did not succeed.

                     

                    How was your set value created for the map? ANd do you know whether it would work if the map of lists was exposed as the output of a SOAP web service?

                     

                    Thanks in advance

                     

                    \Kim

                    • 7. Re: Variable containing a list of lists
                      kc@dafolo.dk Level 1

                      Hi again Vik,

                       

                      Thank you so much for your sample.

                      It works perfectly – however it is not exactly what I was looking for.

                       

                      Let me try to describe the scenario:

                       

                      I have a form with (or without) a schema (I don’t think that it matters that much with the schema). The form needs to be filled through a web service call with the structure that contains the children inside numerous childGroups (like the one you sent me).

                       

                      So when the form opens it reads the social security number and fetches the kids of this person (if any) – these unfortunately cannot be added in the xml and rendered when rendering the pdf.

                       

                      So I need to send a structure like the one described above through a SOAP WS call, how can I do this?

                       

                      Thanks in advance

                       

                      \Kim