Dataport Write file Manually

flintflint Member Posts: 44
Hi,

I develop a DataPort that would export from a dataitem table.

I want to iterat a number of time (determined on Runtime) on a record.

is there any way to make the dataport iterate a number of time on a record ?

Thanks

Comments

  • SavatageSavatage Member Posts: 7,142
    Maybe you can explain a little more what you are trying to do.

    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?
  • flintflint Member Posts: 44
    It's exactly what i want to do.

    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
  • SavatageSavatage Member Posts: 7,142
    Table 15 is the G/L Account table.

    Isn't the data you need in Table 17 G/L Entries?

    I think I'm confused over what you are looking to do. ](*,)
  • flintflint Member Posts: 44
    Hi,

    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
  • AlbertvhAlbertvh Member Posts: 516
    Hi Flint,

    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 :wink:
    <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
Sign In or Register to comment.