Options

[DataPort] : Importing Data into Variables of a SpreadSheet

postmasterpostmaster Member Posts: 12
Hello,

I sincerly need your help, because I'm really blocked.
I developped a Dataport in order to import Data into a General journal SpreadSheet, but in this SpreadSheet we got in addition to table columns, some Global variables.

So my question is : How to affect these global variables from my DataPort?
With table columns I have no problem.

I'm waiting for your answers.

Thanks in advance

Comments

  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Can you give an example of a global variable? I am not sure if I understand what you mean?
  • Options
    postmasterpostmaster Member Posts: 12
    Can you give an example of a global variable? I am not sure if I understand what you mean?

    I mean a Variable created by the menu "View - C/AL globals".
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Yes, I know what a global variable is, thank you for explaining. :idea:

    What I don;t understand is where you create it and what you want to do with it.

    Please give an example of the structure of your code.
  • Options
    postmasterpostmaster Member Posts: 12
    Yes, I know what a global variable is, thank you for explaining. :idea:

    What I don;t understand is where you create it and what you want to do with it.

    Please give an example of the structure of your code.


    I conceived the Dataport with a DataItem. I parametred the Dataport fields and I created global variables wich I put also in the Dataport fields to held all the information of the file to be imported in the spreadSheet.

    Know the import succeed to import Data into all the fields(Table) of the SpredSheet but not in the variables declared in the same SpreadSheet.

    To resolve that I thought to put the affectation on trigger : OnAfterImportRecord but I don't know how to address the variables of the spreadSheet.
    I guess this affectation impossible : Table_name.SpreadSheet_Variable_name:=DataPort_Variable_name;

    DataPort_Variable_name is the variable which held an information from the import file.

    Thanks in advance for your help
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Can we please talk Navision language? :shock:

    If a spreadsheet is a General Journal Line, please call it that.

    If your dataitem is a general journal line, you can poplulate it with
    "Gen. Journal Line".Field := GlobalVariable;
    

    What table is the dataport based on? What do you use for Journal Template/Batch. How have you solved the line numbering?
  • Options
    postmasterpostmaster Member Posts: 12
    Can we please talk Navision language? :shock:

    If a spreadsheet is a General Journal Line, please call it that.

    If your dataitem is a general journal line, you can poplulate it with
    "Gen. Journal Line".Field := GlobalVariable;
    

    What table is the dataport based on? What do you use for Journal Template/Batch. How have you solved the line numbering?

    That's right...
    The DataItem of the DataPort is Gen. Journal Line and it's the same for the target SpreadSheet(General Journal).

    "Journal Template Name" :PAIE
    "Journal Batch Name" :DEFAUT

    For the line numbering for now I put them manually in the import file (i.e : 10000, 20000, ... 40000).
    The import succeed anyway but some columns of SpreadSheet (General Journal line) which are based on Variables are not set (no values imported).
  • Options
    AlbertvhAlbertvh Member Posts: 516
    Do you declare your variables on the Dataport fields?

    Also remember to initilize the record and all the variables in the trigger OnBeforeImportRecord

    If so then Marks' solution should work.
  • Options
    postmaster78postmaster78 Member Posts: 2
    Albertvh wrote:
    Do you declare your variables on the Dataport fields?

    Also remember to initilize the record and all the variables in the trigger OnBeforeImportRecord

    If so then Marks' solution should work.


    All my variables are declared.
    Mark's solution work, but it's not the solution that I'm looking for, my problem is how to initialise(affect values) to variables of "General Journal Window".

    In the "General Journal Window" I got fields of "Gen. Journal Line" and also some variables.
    When I run my DataPort the "Gen. Journal Line" are well affected because I see That on the screen "General Journal Window" but it's not the case of the variables of the screen "General Journal Window".

    The variables are of type of ShortcutDimCode[..]


    I hope that there is a solution.
    Thanks very much for your help.
  • Options
    AlbertvhAlbertvh Member Posts: 516
    Hi Postmaster,

    If you are using Shortcut Dimensions you only have 1 and 2 defined on the Gen. Journal Line table you will also need to update Journal Line Dimension table (356) as this stores all the dimensions from 1 to 8

    Hope this helps sort out your problem :D

    Or you could use in the OnBeforeImport trigger

    ValidateShortcutDimCode(x,DimCode);

    where x is 1 to 8

    I'm assuming here that you dataitem is table 81 Gen. Journal Line
  • Options
    postmaster78postmaster78 Member Posts: 2
    Albertvh wrote:
    Hi Postmaster,

    If you are using Shortcut Dimensions you only have 1 and 2 defined on the Gen. Journal Line table you will also need to update Journal Line Dimension table (356) as this stores all the dimensions from 1 to 8

    Hope this helps sort out your problem :D

    Or you could use in the OnBeforeImport trigger

    ValidateShortcutDimCode(x,DimCode);

    where x is 1 to 8

    I'm assuming here that you dataitem is table 81 Gen. Journal Line

    Coooooooool,

    Thanks very much, I just test your solution, and it's ok, I just put the code ValidateShortcutDimCode(x,DimCode) OnAfterImport trigger.
  • Options
    AlbertvhAlbertvh Member Posts: 516
    Glad to help \:D/
Sign In or Register to comment.