XML in 3.10

andyjarvis
Member Posts: 9
How do i get XML output from several tables in V 3.10 Navision??
I take it i use a dataport but the only way i can see to do it is to create the tags manually??
Do any of you guys and Gals have some sample code for doing this, Im afraid ive been spoilt by V4 XML Ports!!
Thanks in advance
Andy
I take it i use a dataport but the only way i can see to do it is to create the tags manually??
Do any of you guys and Gals have some sample code for doing this, Im afraid ive been spoilt by V4 XML Ports!!
Thanks in advance
Andy
0
Comments
-
Hello Again!
I'm not sure about the Object numbering for different suppliers of the Payroll module, but you should have a Report for the End of Year Payroll submission - my object id is Report 9000238. This uses functions to output start and end tags and the values. The XML generated is then used by the Internet Submission codeunit.
Have a look at that report if you have access to it. If not, let me know and I will see what i can do for you.
I'm afraid its all manual tags though - sorry!0 -
Im afraid i dont have that - or the payroll modules at all, we are offshore so dont have standard UK Payroll, we have developed our own, Can you help any further! I am starting to get desperate!! :shock:0
-
Why don't you just use the Microsoft XML Core Services library? The latest version can be downloaded from http://msdn.microsoft.com/xml/default.aspx, but I think all recent Windows version also come with the latest version.Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
I haven't license to see codeunit. But I use the codeunit "XML-Excel Reports Mgt." by analogy with another reports.
This codeunit create XML file in temporary folder before running excel.0 -
The last time I needed to get data out of Navision and into an XML file I created a c# app that used c/odbc to get the values from Navision. This allowed me to easily use an xml schema and xml validation in my c# app.
Would you be able to try this instead?
I will provide some sample Navision code for simple output to a file if you don't want to use the .net route - I am just trying to make sure this is your only option.
Thoughts?0 -
Some sample C# code may be the way forward but i wrote a VB6 app to do the job and it failed due to the C/ODBC Driver being slow connecting and it would have taken over 1 2hours to run due to the amount of data!!
I can give it a go though.,0 -
Ok, lets try direct from Navision!
Add a variable fo type 'File', say myFile. Now create 2 functions; one called 'AddTag' and another called 'AddTagAndValue'.
AddTag should take in 2 text parameters (myTag and myAttribute) and AddTagAndValue should take in 2 text parameters (myTag and myValue).
AddTag should do something like this:
IF myAttribute <> '' THEN
outputText := '<' + myTag + ' ' + myAttribute + '>';
ELSE
outputText := '<' + myTag + '>';
myFile.WRITE(outputText);
AddTagAndValue should do this:
outputText := '<' + myTag + '>' + myValue + '<\' + myTag + '>';
myFile.WRITE(outputText);
In your Codeunit/Dataport/Report/Form you can then do something like:
AddTag('EmployeeList','');
AddTag('Employee','id=1');
AddTagAndValue('Name','Jeff Jefferson');
AddTagAndValue('Age','32');
AddTag('/Employee','');
AddTag('Employee','id=2');
AddTagAndValue('Name','John Johnson');
AddTagAndValue('Age','43');
AddTag('/Employee','');
AddTag('/EmployeeList','');
This should produce XML that looks a bit like this:
<EmployeeList>
<Employee id=1>
<Name>Jeff Jefferson</Name>
<Age>32</Age>
</Employee>
<Employee id=2>
<Name>John Johnson</Name>
<Age>43</Age>
</Employee>
</EmployeeList>
Will this do what you are looking for?
You just need to set up your filename and path and you should be good to go! Obviously, I imagine you will need to set up some loop structures to get the correct XML, but this should be a start.
This code has not been checked, so you may need to tweak it a little!
Let me know how you get on!0 -
Thankyou a massive amount, that works a treat, just put that code in a report basically so it loop[ed through employees ok and then added in fielname on an option screen,
Fab
Thanks a lot.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