Problem XML structure

gonzy1981
gonzy1981 Member Posts: 156
I'm in a Form, with this values:
No = R000001
ArrivalDate = 24/01/07
DepartureDate = 31/01/07


I did a XMLPort, and the result is this:

Code: Select all
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Booking>
<No>R0000001</No>
<ArrivalDate>24/01/07</ArrivalDate>
<DepartureDate>31/01/07</DepartureDate>
</Booking>

But i want, to have this:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Object type="Form" id="50000" caption="Booking" url="navision://client/run?servername=SERVER%5Csql2008%26database=NAV5_01%26company=CRONUS%20CZ%26target=Form%205000%26view=SORTING(Field1)%26position=Field1=0(R0000001)%26servertype=MSSQL">
<Row>
<Control type="TextBox" value="R0000001" width="2750" id="1" name="No" />
<Control type="TextBox" value="24/01/07" width="2750" id="2" name="ArrivalDate" />
<Control type="TextBox" value="31/01/07" width="2750" id="3" name="DepartureDate" />
</Row>
</Object>

Can you help me, to do my XML, to this way?

Comments

  • DenSter
    DenSter Member Posts: 8,307
    Those properties are not stored as field values in any table, and I don't know of any way to retrieve that kind of information from an object. Defining the XML structure itself is easy, but I don't see how you could populate XML like that.
  • kine
    kine Member Posts: 12,562
    You need to add appropriate "Attribute" for each "Element" into your XMLPort...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSter
    DenSter Member Posts: 8,307
    Yeah like I said it's easy to create an XMLPort with that structure, but the data is going to be difficult. It looks like he's trying to put form information into the XML, and I don't know where you'd get that from.
  • kine
    kine Member Posts: 12,562
    It seems like some direct use to generate web page. I assume that most of the data are fixed... but it is just guess... it is now on gonzy1981 if he will need something more. :whistle:

    8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gonzy1981
    gonzy1981 Member Posts: 156
    In the function CreateXML i need load the structure of the Form, to pass this .XML to a CODEUNIT403.LaunchApp

    I'm trying to do this:


    Rec.FINDFIRST;
    REPEAT
    CLEAR(Automation2);
    CREATE(Automation2);
    CLEAR(Automation5);
    CREATE(Automation5);

    CreateXML;
    Automation2.load(NameXML);

    //RecStyleShhet."Style Sheet ID" is a GUID
    RecStyleSheet.SETRANGE("Object ID",7074236);
    RecStyleSheet.FINDFIRST;

    CODEUNIT403.SelectStyleSheet(0,FORM::"Draft",RecStyleSheet."Style Sheet ID");
    CODEUNIT403.LaunchApp(Automation2,RecStyleSheet."Style Sheet ID",Automation5);
    Automation5.save('C:\Automation5.XML');
    SHELL('C:\Archivos de programa\Microsoft Office\Office12\WINWORD.EXE','C:\Automation5.xml');

    UNTIL Rec.NEXT = 0;
  • Steve.Desmedt
    Steve.Desmedt Member Posts: 13
    Hey Gonzy,

    I was wondering if you have already found a solution to create the XML file ?

    Kind regards

    Steve