Hi all,
im developing an import dataport. the scope of this dataport is to import new items. till this stage everything works correctly including validation. my problem is that i want to create a text file whenever the dataport find invalid data (ex. item already exists, or Inventory posting group does not exist)
Im using the Table.Validate function to insert data such as the inventory posting group. is there any way that i capture the error when it occurs on this function and pass it on in order to be written in the text file. (i am thinking the log file would have a simple structure such as : Item No. and a text message ex, inventory posting group does not exist)
my idea was to use the if statement and include the table.validate function within, but it does not return a boolean value. any ideas??
Thanks
0
Comments
And for boolean return value you could use and in OnRun
said (e.g. i used this "trick" to handle the error returned from excel if an "excel find" fails, too)...i'm working on it, i will post it somewhere
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
im still unsure about the rest, i am not using any codeunit. please find below an extract of my code:
IF (Item.GET(ItemTemp."No.")) THEN //if item is found generate an error message
BEGIN
"Write Error";
//ERROR('Item Exists');
END
ELSE //else if item does not exist
BEGIN
Item."No." := ItemTemp."No."; //insert item no. and the required fields
Item.INSERT;
Item."Barcode No." := ItemTemp."Barcode No.";
Item.Description := ItemTemp.Description;
Item."Description 2" := ItemTemp."Description 2";
"Create ItemUOM"(ItemTemp."No.",ItemTemp."Base Unit of Measure");
Item.VALIDATE(Item."Base Unit of Measure",ItemTemp."Base Unit of Measure");
"Create ItemUOM"(ItemTemp."No.",ItemTemp."Sales Unit of Measure");
Item.VALIDATE(Item."Sales Unit of Measure",ItemTemp."Sales Unit of Measure");
Item.VALIDATE(Item."Inventory Posting Group",ItemTemp."Inventory Posting Group");
Write Error and Create ItemUOM are functions i wrote. as you can see from the first part i ama ble to write the item no in the log file if that does not exist. where im having a problem is with the other validate functions because i cannot insert any if else statements.
you know what i mean.
http://www.BiloBeauty.com
http://www.autismspeaks.org