Hi All,
I have created one xml port which used to export one company data from one table( table A). But now I want to retrieve all the company details from that table'A' without changing the company.
Ex: Table 'A' - has all company(Cronus usa,Cronus canada...etc) data. I am accessing canada USA,I want to export all the company data without changing to another the company
Can you please help me to do this.
Thanks in advance,
Jacob.A
0
Answers
Can you please provide me some code snippet for this.
TableA1 and TableA2
When You use these table variables they will use data from current company
TableA1.FINDFIRST;
REPEAT
.....
UNTIL TableA1.NEXT=0;
But when You use
TableA2.CHANGECOMPANY('Other database company name');
TableA2.FINDFIRST;
REPEAT
.....
UNTIL TableA2.NEXT=0;
You will get all records from TableA, but from other (not current) company ;o)
In XML port it can be two names where OnPreXMLItem You can use this CHANGECOMPANY
Thanks for your suggestion.
I have more than 20 companies in my environment.
So is this possible to get all company data without hard coding individual company name company name?
It seems to be working.
Thank you so much
Warm regards,
Jacob.A
Where I have to use the code snippet in xml port?
when i was trying the code in codeunit ther it works.
But in xml port it didnot work. I was putting the code in onprexmlport() trigger.
Please help me with the correct trigger to put the code.and also i want to get the data for only five companies not for all 20 companies.
Guide me,,,
Thanks,
Jacob.A
This entirely depends on how your XML port is structured. I had actually written a reply to you earlier, but Mibuso for some reason dumped it into "waiting for approval".
Anyway, in short, you could have a codeunit that switches companies on your chosen table, and that passes that table to an XMLPort. Something along the lines of
Again, that depends entirely on how your XMLPort is structured. The approach I suggest depends on you having your TableA as the "root" record in the XMLPort.