Actually I want to export the balance of a given account calculatade by business unit (in a consolidation company).
The dataport is based on table 15, so for every account he must calculate the balance by setting :
the BU and the posting date.so we have different BU so the dataport must iterate a number of time(number of BU determinated at RUNTIME) on every record.
the way i found was to iterate manually on the triggers
OnAfterGetRecord and then write the dta manually.it's not very funny to do this and i think there must be a way more simple !!!
- Export the balance of every Account by using the table G/L Account and
calculate the balance by calling the magic function CALCFIELDS("Balance") after stting some filter on this FlowFields.
YES the data is in G/L Entries(but how care :roll: ).
The problem is that i'm doing this on a consolidation Company, so for every Account i need to calculate the Balance by Business Unit.
So in a perfect world it would be somthing like :
For i:=0 to THE_NUMBER_OF_BUSINESS_UNIT DO BEGIN
"Business Unit Code" := CurrCode;
CALCFIELDS("Balance");
END;
Unfortunally, in a Dataport it's not possible to iterate several times on a record.
My question is : is there any way to iterate on a record (not manually of course) or the only way to do this is to iterate manually on the trigger:
I guess by BU you mean different companies?
If true then you could do the following
create a new Codeunit
OnRun section
If Company Find('-') then
REPEAT
MyDataPort.SetCompany(Company.Name);
MyDataport.RUN;
UNTIL Company.Next = 0;
<Edit>
You must not include your consolidated company of course
<End Edit>
DataItem Name
Company Company
in your dataport
SetCompany(LvName) This is the new fuction called from you codeunit
CompanyName := LvName; // Type Text variables
Comments
What table do you want to export from?
It sound like you want to enter a number (call it X) and have the dataport loop X number of times exporting the same data X amount of times.
Or did I lose something in the translation?
http://www.BiloBeauty.com
http://www.autismspeaks.org
Actually I want to export the balance of a given account calculatade by business unit (in a consolidation company).
The dataport is based on table 15, so for every account he must calculate the balance by setting :
the BU and the posting date.so we have different BU so the dataport must iterate a number of time(number of BU determinated at RUNTIME) on every record.
the way i found was to iterate manually on the triggers
OnAfterGetRecord and then write the dta manually.it's not very funny to do this and i think there must be a way more simple !!!
thanks for your help
Isn't the data you need in Table 17 G/L Entries?
I think I'm confused over what you are looking to do. ](*,)
http://www.BiloBeauty.com
http://www.autismspeaks.org
It's so simple what i want to to :
- Export the balance of every Account by using the table G/L Account and
calculate the balance by calling the magic function CALCFIELDS("Balance") after stting some filter on this FlowFields.
YES the data is in G/L Entries(but how care :roll: ).
The problem is that i'm doing this on a consolidation Company, so for every Account i need to calculate the Balance by Business Unit.
So in a perfect world it would be somthing like :
For i:=0 to THE_NUMBER_OF_BUSINESS_UNIT DO BEGIN
"Business Unit Code" := CurrCode;
CALCFIELDS("Balance");
END;
Unfortunally, in a Dataport it's not possible to iterate several times on a record.
My question is : is there any way to iterate on a record (not manually of course) or the only way to do this is to iterate manually on the trigger:
OnAfterGetRecord()?
Thanks
I guess by BU you mean different companies?
If true then you could do the following
create a new Codeunit
OnRun section
If Company Find('-') then
REPEAT
MyDataPort.SetCompany(Company.Name);
MyDataport.RUN;
UNTIL Company.Next = 0;
<Edit>
You must not include your consolidated company of course
<End Edit>
DataItem Name
Company Company
in your dataport
SetCompany(LvName) This is the new fuction called from you codeunit
CompanyName := LvName; // Type Text variables
OnPreDataItem section
GLAcct.CHANGECOMPANY(CompanyName);
OnBeforeExport
CALCFIELDS(Balance);
Hope this helps
Albert