XML Ports with Format Property - Variable Text

apickard
Member Posts: 42
Hi all,
in Dynamics NAV 2009, if you set an XML port to be used in RTC with Format property set to Variable text, is it possible to create dependent nodes in the same XML dataport of type table? :-k
I'm asking this question as I tried to create such nodes (eg. Customer and Customer ledger entry) and the following error is being displayed: "An element with source type Table cannot have Table element children".
If Format property is changed to XML, this same setup works correctly.
Any ideas how this can be solved!!
in Dynamics NAV 2009, if you set an XML port to be used in RTC with Format property set to Variable text, is it possible to create dependent nodes in the same XML dataport of type table? :-k
I'm asking this question as I tried to create such nodes (eg. Customer and Customer ledger entry) and the following error is being displayed: "An element with source type Table cannot have Table element children".
If Format property is changed to XML, this same setup works correctly.
Any ideas how this can be solved!!
0
Comments
-
You can include another table, but you need to nest it into some text attribute to have structure like:
Customer - table CustomerLedgerEntries - text CustomerLedgerEntry - table
0 -
Hi Kamil,
first of all thanks for your reply. However when I tried this option the system displayed the following error: "If element has source type table, then it cannot have grandchildren". What I tried was:
Customer - element - table - Indentation1
CustLedEntries - ( both attribute and element) - text - Indentation2
CustLedEntry - element - table - Indentation3
I've also tried other alternatives without any success. These errors do show up only when the XML Port format property is set to either Variable Text or Fixed Text!!
Am I doing something wrong?0 -
Hi all,
any ideas about this issue #-o
Are xml ports with the new format property being used extensively??
Thanks for all suggestions0 -
Hi everybody,
Bumped into the same problem! Even more - VariableText and FixedText formats are not working when you run XMLPorts from Classic Client - so you have to call the XMLPort from RTC to make sure it exports data in those formats.
But I *almost* made it work by implementing the structure in the attachment. I built it on two Integer tables and doing all filtering and navigation through recordsets in C/AL at OnPreXMLItem and OnAfterGetRecord triggers.
First Integer table has SourceTableView set to WHERE(Number=CONST(1)) second - not limited.
The reason I am saying *almost* - still need to debug C/AL part to make it work properly for all scenarios - have a couple of minor glitches there. But I have to run now - so I am giving you what I have so you could play with it if it is urgent. Otherwise - I will post working example on Monday.0 -
I've finished the example and here is what I ended up with (unfortunately cannot attach .fob here):
Codeunit XML Port RunnerOnRun() Path := 'd:\Invoices.txt'; SalesDocumentNo := '101015'; IF EXISTS(Path) THEN ERASE(Path); DataFile.WRITEMODE(TRUE); DataFile.TEXTMODE(TRUE); DataFile.CREATE(Path); DataFile.CLOSE; //Needed for RTC DataFile.OPEN(Path); ExportSalesOrder.SetSalesHeader(SalesDocumentNo); // Sets the Sales Header to be exported DataFile.CREATEOUTSTREAM(XMLOutStream); ExportSalesOrder.SETDESTINATION(XMLOutStream); ExportSalesOrder.EXPORT; DataFile.CLOSE; MESSAGE('Done!')
XML Port Export Sales Order (Format: FixedText, all Width properties for the fields are set to 10)PROCEDURE SetSalesHeader(DocumentNo : Code[20]) SH.GET(SH."Document Type"::Order,DocumentNo)
IntegerSalesLine - Export::OnPreXMLItem() SL.SETRANGE("Document Type",SH."Document Type"); SL.SETRANGE("Document No.",SH."No."); IF NOT SL.FINDSET THEN currXMLport.QUIT; NoOfRecords := SL.COUNT; CurrentRecNo := 0; IntegerSalesLine - Export::OnAfterGetRecord() CurrentRecNo := CurrentRecNo + 1; IF NOT (CurrentRecNo = 1) THEN BEGIN IF CurrentRecNo > NoOfRecords THEN currXMLport.QUIT ELSE SL.NEXT; END
And code lines like these at all Export::OnBeforePassVariable triggets:Header_No. - Export::OnBeforePassVariable() "Header_No." := SH."No."; Line_Line_No. - Export::OnBeforePassVariable() "Line_Line_No." := FORMAT(SL."Line No.");
And here is what I get when I run this codeunit from RTC:101015 49633663 Autohaus M 10000 Item 1972-S MUNICH Swi 20000 Item 1968-S MEXICO Swi 30000 Item 1896-S ATHENS Des 40000 Item 1906-S ATHENS Mob
Best regards,
DMC0 -
It appears that things can be done much easier when "upgrading" a dataport to XMLPort object. You don't have to use Integer table to navigate through header and lines, you can actually use the tables themselves – just like you could with dataports.
And since you cannot indent Dataitems, you have to filter the lines at OnPreXMLItem trigger. In my example I use Source Type = Text, but Field is also supported.
Below you can see the settings I used for an XMLPort with Variable Text format (semicolon separated) – they are quite different from default.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions