Hi all,
I am importing the data from excel . while importing from excel, I need to generate the dimension set id on the fly.So I have written the code like follows.
SalesSetup.GET;
SLSMS.RESET;
IF SLSMS.FINDSET THEN REPEAT
IF SL.GET(SLSMS."Document Type",SLSMS."Document No.",SLSMS."Line No.") THEN;
IF NOT DimValue.GET(SalesSetup."Intake ID",SLSMS."Intake ID") THEN BEGIN
DimValue.INIT;
DimValue.VALIDATE("Dimension Code",SalesSetup."Intake ID");
DimValue.VALIDATE(Code,SLSMS."Intake ID");
DimValue.INSERT(TRUE);
END;
IF NOT DimValue.GET(SalesSetup."Course Type",SLSMS."Course Type") THEN BEGIN
DimValue.INIT;
DimValue.VALIDATE("Dimension Code",SalesSetup."Course Type");
DimValue.VALIDATE(Code,SLSMS."Course Type");
DimValue.INSERT(TRUE);
END;
IF NOT DimSetEntryInsert.GET(SL."Dimension Set ID",SalesSetup."Intake ID") THEN BEGIN
DimSetEntryInsert.INIT;
DimSetEntryInsert."Dimension Set ID" := SL."Dimension Set ID";
DimSetEntryInsert.VALIDATE("Dimension Code",SalesSetup."Intake ID");
DimSetEntryInsert.VALIDATE("Dimension Value Code",SLSMS."Intake ID");
DimSetEntryInsert.INSERT(TRUE);
//MESSAGE(DimSetEntryInsert."Dimension Value Code");
END;
DimSetEntryInsert.VALIDATE("Dimension Value Code",SLSMS."Intake ID");
DimSetEntryInsert.MODIFY(TRUE);
IF NOT DimSetEntryInsert.GET(SL."Dimension Set ID",SalesSetup."Course Type") THEN BEGIN
DimSetEntryInsert.INIT;
DimSetEntryInsert."Dimension Set ID" := SL."Dimension Set ID";
DimSetEntryInsert.VALIDATE("Dimension Code",SalesSetup."Course Type");
DimSetEntryInsert.VALIDATE("Dimension Value Code",SLSMS."Course Type");
DimSetEntryInsert.INSERT(TRUE);
END;
DimSetEntryInsert.VALIDATE("Dimension Value Code",SLSMS."Course Type");
DimSetEntryInsert.MODIFY(TRUE);
DimSetEntryInsert.RESET;
DimSetEntryInsert.SETRANGE("Dimension Set ID",SL."Dimension Set ID");
IF DimSetEntryInsert.FINDSET THEN REPEAT
MESSAGE(DimSetEntryInsert."Dimension Code");
FinalDimSetEntry.COPY(DimSetEntryInsert);
UNTIL DimSetEntryInsert.NEXT = 0;
DimSetEntryInsert.GetDimensionSetID(FinalDimSetEntry);
//MESSAGE('%1',DimSetEntryInsert.GetDimensionSetID(FinalDimSetEntry));
UNTIL SLSMS.NEXT = 0;
But its not working properly. If anyone has any view on how to change the code to dynamically generate the dimension set id, please let me know.
Thanks in advance.
Regards,
chandru.
0
Comments
http://mibuso.com/blogs/davidmachanick/
"Dimension Set ID" := DimMgt.GetDimensionSetID(TempDimSetEntry);