I create a dataport for importing data, and re-calculate the amount. But it won't update the amount, any mistake in my coding? thank you.
OBJECT Dataport 90002 Item2007Opening ImpUpdate
{
OBJECT-PROPERTIES
{
Date=24/07/09;
Time=[ 4:49:55 PM];
Modified=Yes;
Version List=;
}
PROPERTIES
{
FileFormat=Variable;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table90021;
AutoSave=Yes;
AutoUpdate=Yes;
AutoReplace=Yes;
DataItemTableView=SORTING(Item No.);
OnAfterImportRecord=BEGIN
g_recItem2007Opening.SETFILTER("Item No.","Item 2007 Opening"."Item No.");;
IF g_recItem2007Opening.FIND('-') THEN
BEGIN
g_recItem2007Opening.GET("Item 2007 Opening"."Item No.");
intAmount := g_recItem2007Opening."Unit Cost" * g_recItem2007Opening.Quantity;
g_recItem2007Opening.Amount := intAmount;
//g_recItem2007Opening.VALIDATE(Amount, intAmount);
g_recItem2007Opening.MODIFY;
END;
END;
}
FIELDS
{
{ ; ;"Item No." }
{ ; ;Quantity }
{ ; ;"Unit Cost" }
{ ; ;Amount }
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
}
}
CODE
{
VAR
g_recItem2007Opening@1000000000 : Record 90021;
intAmount@1000000001 : Integer;
BEGIN
{
/* This is used to import the "Unit Cost" into the table 'Item 2007 Opening'
/* And then re-calculatte the amount ["Unit Cost" * Quantity] in the table 'Item 2007 Opening'
/* The .csv file just contains two columns: 1) Item No. 2) Unit Cost
}
END.
}
}
0
Comments
And why you first do a g_recItem2007Opening.GET after you did a IF g_recItem2007Opening.FIND('-') THEN is mystery to me.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!