Hi there. I'm facing a problem here.
The requirements of my (importing from request form)assignment are:
1. Have to do dimension checking and only after dimensions are checked you have to import the data.
2. Filter the Default Dimension table based on the value of Item Table’s "No." field.
3. Check the Dimensions item
4. Filter the default dimension using table 27 and item.”No.” and check if this dimension “do not export” (a checkbox field) in the master dimension table. If yes skip and just import the data.
Can anyone guide me? how do i filter the default dimension table based on "No." field in Item table using codings?
I've written these in the OnBeforeImportRecord()
vDefDim.RESET;
vDefDim.SETRANGE(vDefDim."Table ID",27);
vDefDim.SETRANGE("No.",Item."No.");
IF vDefDim.FINDSET THEN BEGIN
REPEAT
vNewDefDim.INIT;
vNewDefDim.TRANSFERFIELDS(vDefDim);
vNewDefDim."Table ID" := 27;
vNewDefDim.INSERT;
UNTIL vDefDim.NEXT = 0;
END;
Thanks in advance!
0
Comments
vDefDim.RESET;
vDefDim.SETRANGE(vDefDim."Table ID",27);
vDefDim.SETRANGE(vDefDim."Dimension Code",dimval."Dimension Code");
vDefDim.SETFILTER("No.",Item."No.");
IF vDefDim.FINDSET THEN BEGIN
REPEAT
IF dimval."Do not Export to 3PL" =TRUE THEN BEGIN
CurrDataport.SKIP;
END
ELSE BEGIN
vNewDefDim.INIT;
vNewDefDim.TRANSFERFIELDS(vDefDim);
vNewDefDim."Table ID" := 27;
vNewDefDim.INSERT;
END;
UNTIL vDefDim.NEXT = 0;
END;
The thing is my instructor said it's incorrect.
His requirements are:
1) The dataport is to Update the 4 fields of the Existing Item Table. When you try to update this using dataport you have to check the Default Dimensions of item table linked and check against the Dimension Value Table where we have added a new field “Do not Export to 3PL”. If this field is ticked then this item will be skipped.
2) Your dataport fields will have only 5 fields, Item No., Depth, Width, Height and Unit Volume.
3) When you import this, you will check the Default Dimension Value for the Dimensions of this item, If item have 3 dimensions[3 records in default dimension] you will use repeat until and read all 3 dimensions records. Inside this repeat until, you will filter the ‘Dimension Value’ Table and check if the Do not Export to 3PL is ticked or not. If not tick then you can update the item table with the new values of ‘Width’,Depth,Height etc, if the field is ticked you will skip the item record using currdataport.skip.
Can anyone tell me where did i go wrong and provide some help in codings? ](*,)
vNewDefDim.TRANSFERFIELDS(vDefDim);
vNewDefDim."Table ID" := 27;
vNewDefDim.INSERT;
Here is where you are mistaken. You shouldn't use TRANSFERFIELDS function here.
It should be something like this
vNewDefDim.No.:=vDefDim.No.;
vNewDefDim.Depth:=vDefDim.Depth;
vNewDefDim.Width := vDefDim.Width;
vNewDefDim.Height := vDefDim.Height;
vNewDefDim.Unit Volume := vDefDim."Unit Volume";
vNewDefDim.INSERT;
And if you are required only to modify and not insert then you must not use vNewDefDim.INSERT, but if the vNewDefDim table is supposed to be empty before you use the dataport then its alright.