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
0
Comments
I mean a Variable created by the menu "View - C/AL globals".
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
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
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).
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.
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
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.