15 Replies Latest reply on Jan 19, 2011 1:13 PM by pguerett

    Get XML from Data Model

    Michael.Imhoff

      I'm using a Fiber Data Model as a variable in my process, and I'm ultimately trying to push this data into an xdp.  When I record the process back, I'm able to view all of the data within it and it appears in an xml fashion.  Converting this variable into a document simply dumps a ByteArray.  So I'm curious, is it possible to easily convert the fml data into a usable object such as xml or a document that I can pass around to other activities?

       

      Thanks for your help,

      Michael

        • 1. Re: Get XML from Data Model
          pguerett Level 6

          Yes the fiber model generates an xml data structure that can be used with other forms. Normally you woudl use the Designer to import the fiber model and this will allow you to bind the inbound xml to the appropriate fields on the form (Note that you can only create a static non-interactive PDF this way - this is called a Document of Record or DOR). When the data comes back in it is in an XML format ...the services that do the merging of template and data together expect the data in a document variable so you can use a setValue operation to cast the xml var to a doc var.

           

          Hope that helps

          Paul

          • 2. Re: Get XML from Data Model
            Michael.Imhoff Level 1

            Hi Paul,

             

            First off, thanks for your reply, but I should have been a bit more clear.  I have a variable of type FiberDataModelTest in my process, and I'm trying to cast that variable to xml or a document so that I can push it into an activity that would render a pdf.  I'm not seeing a way to cast that variable.  Am I missing something obvious?

             

            Thanks again,

            Michael

            • 3. Re: Get XML from Data Model
              pguerett Level 6

              Are you sure that is the type ....I do not have any FiberDataModelTest types in my system. Are you exposing part of your model to the server and that is where this type is coming from? If so ....it is really just XML ....you may have to cat to XML first then cast the XML to Doc .....you can try casting directly to doc but I do not know if that will work.

               

              Paul

              • 4. Re: Get XML from Data Model
                Michael.Imhoff Level 1

                Hi Paul,

                 

                FiberDataModelTest is simply a 'Data Model' that I just created for my application in workbench, similar to me creating MikesTest, Product, Cart, etc.  From what I can tell, LiveCycle Data Models can't be cast to xml, which I find strange as they seem to be self aware of their own schema.

                 

                Hope that helps clear up what I'm trying to do.

                 

                Thanks again,

                Michael

                • 5. Re: Get XML from Data Model
                  pguerett Level 6

                  OK now I get it .....so why do you want an xml representation of the model ...what will it give you?

                   

                  Paul

                  • 6. Re: Get XML from Data Model
                    Michael.Imhoff Level 1

                    I have an xdp that's wired to that data model, and I want to generate a pdf off of that xdp with the populated data model.

                    • 7. Re: Get XML from Data Model
                      pguerett Level 6

                      Then open the xdp form template that you want to fill in Designer and import the fiber model into Designer. This will create a data structure that you can set up bindings to for each of your fields. Now when you merge data that follows that structure the form will perform the bindings and place the data into the correct fields.

                       

                      Paul

                      • 8. Re: Get XML from Data Model
                        Michael.Imhoff Level 1

                        Hi Paul,

                         

                        I have the xdp configured and ready to go.  What activity should I use to merge my populated data model into the xdp that would return a pdf?  importData, processFormSubmissions, generatePDFOutput, etc all take in a document for data, and I can't get the data model variable converted to a document successfully.  I've very accustomed to using schema's/xml to do this, and am trying to determine what advantages Fiber Data Models provide outside of the pure Data Services arena.

                         

                        Appreciate your thoughts on this,

                        Michael

                        • 9. Re: Get XML from Data Model
                          pguerett Level 6

                          The data model is being applied to a Guide or a Flex application. Assuming it os a Guide then when you submit the data it should be recieved by the calling application as xml that conforms to the fiber model that it was based on.....it is not submitted as a Fiber model. Now that you have it on the server as xml you can use a setValue operation to cast the xml into a document var and then merge it onto the appropriate template.

                           

                          Paul

                          • 10. Re: Get XML from Data Model
                            Michael.Imhoff Level 1

                            Hi Paul,

                             

                            Appreciate your response.  Just so I'm clear, I should simply declare xml variables and import the Fiber model as it's schema.  Is there any reason why you'd want to use actual Fiber-based variables in a process?

                             

                            Thanks again,

                            Michael

                            • 11. Re: Get XML from Data Model
                              pguerett Level 6

                              Yes ....you woudl use those so that you can navigate through the variable in the case that you only need part or or siply a node in the XML. You can still do it if you do not import the model but you as the Designer have to know the structure ...where as if the model is imported you can simply navigate to the node you want.

                               

                              Hoep that helps

                              Paul

                              • 12. Re: Get XML from Data Model
                                Deke S.

                                I am trying to get my head around the purpose of data models within LiveCycle Process Management. If you don't mind I would like to ask a couple of questions that this thread raises for me.

                                 

                                No purpose for Fiber data objects in processes?

                                 

                                What is the reason for the data types in data models being exposed in the process designer? Is there any case for using data model variables? Is it possible for a process to access the services within the data model? Are Fiber data model's inclusion in the process designer just to act as an aid to guide development?

                                 

                                Can some of the Fiber data model functionality available to Flash be used in process?

                                 

                                The Fiber data model seems to me to help the Flash developer by letting him create persistent data on the server without getting his hands dirty implementing the database code. I was looking at the presence of data models within the process designer and wondering if they can help there in the same way. That way, multiple processes could share a set of objects that were persistent because of the data model. Can processes use the querying power of the Fiber model as Flash can?

                                 

                                The take away I have from this discussion is this:

                                 

                                Fiber objects are useful for Flash and, within process management, for guides and forms. Since data received and sent to guides and forms from processes must be XML there is no reason whatsoever to use Fiber objects in processes. I should only use XML based on the data model's schema.

                                 

                                Fiber data objects cannot be coerced directly to XML.

                                • 13. Re: Get XML from Data Model
                                  pguerett Level 6

                                  There are cases where the server can generate subsets of the fiber model for input via web service into a Guide or Flex app. The other reason is if a Guide, form or flex app is used in a process and you want to manipulate the data having the structure of the xml in the var makes it easier to build an XPath statement.

                                   

                                  The question of whether to use a fiber model or a schema shoudl be based on the form technology used in the process and how and if you want to share data between these assets.

                                   

                                  Make sense?

                                   

                                  Paul

                                  • 14. Re: Get XML from Data Model
                                    Deke S. Level 1

                                    "Make sense?" - let me see if I understand. I am trying to get my head around best practices.

                                     

                                    The Fiber data model can be used in a process as a schema for XML that can be passed to Flash (either as a guide or Flex app) or PDF forms that use the Fiber model.

                                     

                                    Fiber model objects should only be used as variables within Flash and Flash-based guides.

                                     

                                    There are no reasons to use Fiber model objects as variables within a process. I should only use XML.

                                     

                                    Within LiveCycle Workbench -> data model designer -> properties view for an entity there is a checkbox under the general tab: "Create LiveCycle datatypes on deploy". That checkbox should never be selected.

                                    • 15. Re: Get XML from Data Model
                                      pguerett Level 6

                                      You got it ....and remember if you use a Fiber model in a PDF form it cannot be an interactive form it can only be a Document of Record (DOR).

                                       

                                      Paul