Hi all,
I wish to reduce the codes as the only part which is changing in the SETRANGE is the Dimension Code part(highlighted in bold) and thus retrieving the corresponding Dimension Value Code from Posted Document Dimension table. This piece of code is being used on a report.
PostedDocDimension.SETRANGE("Table ID",110);
PostedDocDimension.SETRANGE("Document No.","Sales Shipment Header"."No.");
PostedDocDimension.SETRANGE("Dimension Code",'D');
IF PostedDocDimension.FINDFIRST THEN
GTxt[1]:=PostedDocDimension."Dimension Value Code";
PostedDocDimension.SETRANGE("Table ID",110);
PostedDocDimension.SETRANGE("Document No.","Sales Shipment Header"."No.");
PostedDocDimension.SETRANGE("Dimension Code",'L');
IF PostedDocDimension.FINDFIRST THEN
GTxt[2]:=PostedDocDimension."Dimension Value Code";
PostedDocDimension.SETRANGE("Table ID",110);
PostedDocDimension.SETRANGE("Document No.","Sales Shipment Header"."No.");
PostedDocDimension.SETRANGE("Dimension Code",'H');
IF PostedDocDimension.FINDFIRST THEN
GTxt[3]:=PostedDocDimension."Dimension Value Code";
Is there a possible way to optimize the codes as I am fetching from the same Table ID and Document No..
Please help me.
Thanks
Liizz
0
Comments
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
Below code will not work if you have multiple records per Dimension Code.
Just a happy frood who knows where his towel is