Hi,
How can i export data of 2 tables that must be linked by some fields (ex.: Production Order and Production Order Line) to a .txt file using only one dataport.
I've already did this but when i indent the second Data Item and try to compile, i receive a error message saying that the file format is not in UPXML.
And i want to export to .txt format
Look at the Dataport Properties. Probably you have the FileFormat in UPXML (only in User Portal), and you need Variable or Fixed, depending on the txt you want.
What i mean is that the error message appear only when the File Format in not UPXML. And because i want to export with a File Format = Variable, i get this message.
Make a global variable for the production No and one for the production status (these fields are the primary key)
Now fill these fields in the OnAfterExportRecord from the production order DataItem like this:
VariableStatus := Status;
VariableProdOrderNo := "No.";
Go to the production order line dataitem and admit the following code in the OnPreDataItem trigger:
SETRANGE(Status,VariableStatus);
SETRANGE("Prod. Order No.",VariableProdOrderNo);
FIND('-');
That doesn't work. At least if I get you right.
The problem is that you can't indent on a dataport. It means that first all records of DataItem 1 (Header) are being exported. After that, DataItem 2., the lines, will be exported. Problem here is, how do you know which lines?. An alternative would be to create a temp file during the export of the Header records, to capture the key fields for the Lines (or an array if not too many records involved).
Comments
Look at the Application designers guide for more information.
And i want to export to .txt format
Good luck
What i mean is that the error message appear only when the File Format in not UPXML. And because i want to export with a File Format = Variable, i get this message.
Thanks
One cannot indent a dataitem in a dataport. One can have multiple dataitems but not idented for import/export.
That is specially kept for usage in User Portal.
Regards
Tushaar
Roelof.
Make a global variable for the production No and one for the production status (these fields are the primary key)
Now fill these fields in the OnAfterExportRecord from the production order DataItem like this:
VariableStatus := Status;
VariableProdOrderNo := "No.";
Go to the production order line dataitem and admit the following code in the OnPreDataItem trigger:
SETRANGE(Status,VariableStatus);
SETRANGE("Prod. Order No.",VariableProdOrderNo);
FIND('-');
And that's it !
Good Luck !
That doesn't work. At least if I get you right.
The problem is that you can't indent on a dataport. It means that first all records of DataItem 1 (Header) are being exported. After that, DataItem 2., the lines, will be exported. Problem here is, how do you know which lines?. An alternative would be to create a temp file during the export of the Header records, to capture the key fields for the Lines (or an array if not too many records involved).
Roelof.