XMLPort with Multiple Temp Tables
jwilder
Member Posts: 263
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)?
Jason Wilder
jwilder@stonewallkitchen.com
jwilder@stonewallkitchen.com
0
Answers
-
Add one function into the XMLPort, which takes 3 record variables and will copy the data from them into internal variables for the temp tables. Call this function before calling the EXPORT function of the XMLPOrt, you only need to call the XMLPort through XMLPort variable...0
-
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I have done all of that. Now that I have 3 variables populated in the xmlport how do I reference them in the xmlport. Do I create a line that where the source type = table and do I set the temporary property to true?Jason Wilder
jwilder@stonewallkitchen.com0 -
You need to take it from other side- first define the element of type table, set it temporary yes, and populate it in the functions. You do not need to create global variables of type record which are temporary... ;-)0
-
-
kine wrote:You need to take it from other side- first define the element of type table, set it temporary yes, and populate it in the functions. You do not need to create global variables of type record which are temporary... ;-)
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
macl0 -
Instead code sample, could you answer few questions?
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. ;-)0 -
You would have a call to your xmlport, something like the first line here:
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.Jason Wilder
jwilder@stonewallkitchen.com0 -
Thank you for your input. Now I got my example to work. I also tried to use the same logic of passing a temp table from a web service codeunit while the xmlport is the ref parameter of the web service function. However in this scenario I didn't get it to work. The content of the temp table was not passed via xmlport to the C# application calling the web service.0
-
And is the parameter marked as passed by refference and not by value?0
-
No I have passed the parameter by value. I will change it and test it next Tuesday when I will be at the client's site. Thanks for your input.
Best regards,
MACL0 -
You cannot pass temp table by value. Passing record by value is passing only actual record values, no filters, no temp table data...0
-
Now I have passed the parameter by reference and it works!
Thank you once again for your help.
Best regards,
MACL0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
