I need to create an Export only XMLPort based on 3 Temp Tables. Let's pretend the temp tables are Sales Header, Sales Lines and Sales Comments and are filled (as Temp Table) with another process. Now that I have filled the temp tables with my data I need to call the xmlport to export this data. How do I pass the temp tables so the xmlport can use them (andnot use the real Sales Header, Sales Line and Sales Comment)?
0
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
jwilder@stonewallkitchen.com
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
jwilder@stonewallkitchen.com
Hi Kamil Sacek
I have the same problem with passing a temporary record to an xmlport. However I have not exactly understood how to do it. Can you please elaborate and post a code sample. Thanks in advance.
Best regards
macl
1) Are you able to create function in the XMLPort with few parameters of type Record, to pass data you need to export?
2) Are you able to go through these data and insert them into XMLPort variables of type record for each element of type table in XMLPort? (it means, do you know how copy records from one variable of type record into another?) Or you can use fromRec.copy(toRec,ShareTable) function in NAV 2009 if you are using this version.
3) Are you able to call this function before you call .IMPORT or.EXPORT of the XMLPort (of course, you need to define the XMLPort as variable in the calling code)?
If your answers are yes, than do it. If some is no, just learn it from doc, from this forum, or ask again. ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
OrderDetailXMLPort.SetTempTables(OrderHeader,OrderLine);
OrderDetailXMLPort.EXPORT;
To follow through with this example, in your xmlport you would have a function called SetTempTables with 2 paramters. In this case each parameter has the Temporary Property set to Yes and make sure Var = True as well.
In your XMLPort will need 2 Node Variables of Type Table Table and Temporary = Yes. In this case I called them OrderHeader and OrderLine. These 2 variables are defined in the structure of the xmlport not in C/AL Globals, Variables.
In the SetTempTable function you would set the passed in temp table to your Node variable like this:
IF PassOrderHeader.FINDSET THEN BEGIN
REPEAT
OrderHeader := PassOrderHeader;
OrderHeader.INSERT;
UNTIL PassOrderHeader.NEXT = 0;
END;
IF PassOrderLine.FINDSET THEN BEGIN
REPEAT
OrderLine := PassOrderLine;
OrderLine.INSERT;
UNTIL PassOrderLine.NEXT = 0;
END;
Now you can use the OrderHeader and OrderLine variable just like any other record variable in an xmlport.
jwilder@stonewallkitchen.com
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Best regards,
MACL
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thank you once again for your help.
Best regards,
MACL