Importing Secondary Dimension in Gen. Journal Line table

rnjbngrnjbng Member Posts: 82
Hi -

In a .csv file I have a column Project Code which is a shortcut dimension 4. In my XMLPORT is there any way i can just validate a field in the Gen. Journal table and get this secondary dimension into the Dimension set entry table or do I have to something else.
Any help is highly appreciate.

Thanks
RJ.

Best Answer

Answers

  • rnjbngrnjbng Member Posts: 82
    I found this code in this blog but it does not seem to work.

    IF DimVal.GET(GLSetup."Shortcut Dimension 3 Code",ProjectDim) THEN BEGIN
    DimManagment.GetDimensionSet(TempDimSetEntry,GenJnlLine."Dimension Set ID");
    TempDimSetEntry."Dimension Set ID" := GenJnlLine."Dimension Set ID";
    TempDimSetEntry."Dimension Code" := DimVal."Dimension Code";
    TempDimSetEntry."Dimension Value Code" := DimVal.Code;
    TempDimSetEntry."Dimension Value ID" := DimVal."Dimension Value ID";
    IF TempDimSetEntry.INSERT THEN;
    GenJnlLine."Dimension Set ID" := DimManagment. GetDimensionSetID(TempDimSetEntry);
    END;

    Any help appreciated.

    Thanks
    RJ.
  • KishormKishorm Member Posts: 921
    You need to change the 1st line to "Shortcut Dimension 4 Code" (currently it's 3). Also make sure you have done a...
    GLSetup.GET;
    
    ...right at the start.
  • rnjbngrnjbng Member Posts: 82
    Hi Kishorm -

    I have put a code in there Glsetup.get and shortcut dimension 3 code is my project code which is absolutely correct. Still it won't work.

    Thanks
    RJ.
  • rnjbngrnjbng Member Posts: 82
    In my initial post I made a mistake as Shortcut dimension 4 code, its shortcut dimension 3 code. Sorry for the typo.
  • KishormKishorm Member Posts: 921
    Where have you put the code? It should be placed in the OnBeforeInsertRecord Trigger.

    Also is your DataItem called GenJnlLine?
  • rnjbngrnjbng Member Posts: 82
    Yes, the code is onBeforeInsertRecord and GenjnlLine is a variable referring to Gen. Journal line table. My Dataitem is Integer
  • KishormKishorm Member Posts: 921
    It's probably because when you insert the GenJnlLine it calculates and sets the Dimension Set ID at that point. Add the above code after you have inserted your GenJnlLine and then do a GenJnlLine.MODIFY at the end of it.
  • rnjbngrnjbng Member Posts: 82
    Hi Kishorm - I tried everything and still no luck. Its importing now but whatever value is in the first line it gets replicated to the following lines...
  • rnjbngrnjbng Member Posts: 82
    Hi Kishor - Sorry for the delay in getting back to you, I was able to resolve the issue and its working now. Thanks for all your help.
Sign In or Register to comment.