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
0
Comments
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!
Jan Hoek
Product Developer
Mprise Products B.V.
This codeunit create XML file in temporary folder before running excel.
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?
I can give it a go though.,
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!
Fab
Thanks a lot.