Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread whats wrong here ?
Thu, Oct 9 2014 10:13 AMPermanent Link

kamran

Hi

I have some code as follows:

showmessage('Just Before Append');
Datafrm.tbProduct.Append;
showmessage('Just Before Assign');
  Datafrm.tbProduct.FieldByName('PRODUCT_SELLING_CODE').AsString:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_SELLING_CODE').AsString;
  Datafrm.tbProduct.FieldByName('PRODUCT_SELLING_BARCODE').AsString:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_SELLING_BARCODE').AsString;

Datafrm.tbProduct.FieldByName('PRODUCT_CATEGORY_ID').AsString:='UNKNOWN';
Datafrm.tbProduct.FieldByName('PRODUCT_CATEGORY_ONE').AsString:='UNKNOWN CATEGORY';
  Datafrm.tbProduct.FieldByName('PRODUCT_DESCRIPTION_ONE').AsString:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_DESCRIPTION_ONE').AsString;
  Datafrm.tbProduct.FieldByName('PRODUCT_UNIT_QTY').AsInteger:=datafrm.tbTranDetail.FieldByName('TD_TRAN_QTY').AsInteger;
  Datafrm.tbProduct.FieldByName('PRODUCT_WT_KG').AsCurrency:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_WEIGHT_KG').AsCurrency;
  Datafrm.tbProduct.FieldByName('PRODUCT_UNIT_OF_SALE').AsString:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_UNIT_OF_SALE').AsString;
  Datafrm.tbProduct.FieldByName('PRODUCT_SELLING_PRICE_EXC_VAT').AsCurrency:= datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_SELLING_PRICE_EXC_VAT').AsCurrency;
  Datafrm.tbProduct.FieldByName('PRODUCT_SELLING_PRICE_INC_VAT').AsCurrency:=datafrm.tbTranDetail.FieldByName('TD_TRAN_PRODUCT_SELLING_PRICE_INC_VAT').AsCurrency;
  Datafrm.tbProduct.FieldByName('PRODUCT_VAT_PERCENT').AsCurrency:=datafrm.tbTranDetail.FieldByName('TD_TRAN_VAT_PERCENT').AsCurrency;
  showmessage('Just Before Post');
  Datafrm.tbProduct.Post;
  showmessage('New Product Added Successfully');

For some reason it does not get to the 'Just Before Post' message. it goes past the 'Just before append' and 'Just before Assign' messages but then just does nothing after that. Its failing on the assignments ?

I am assigning strings and also dbisam bcd 4 values as currency

Is that not allowed or is that wrong ?

Thanks

Kamran
Thu, Oct 9 2014 10:32 AMPermanent Link

Raul

Team Elevate Team Elevate

On 10/9/2014 10:13 AM, kamran wrote:
> For some reason it does not get to the 'Just Before Post' message. it goes past the 'Just before append' and 'Just before Assign' messages but then just does nothing after that. Its failing on the assignments ?
> I am assigning strings and also dbisam bcd 4 values as currency
> Is that not allowed or is that wrong ?

My guess is you're getting an exception thrown and since you are not
handling any errors conditions function will just exit with and error.

Try something like this and see if you get an exception thrown and see
what the actual message is :

try
   showmessage('Just Before Append');
   <... rest of the code as before ... >
      showmessage('New Product Added Successfully');
except
      On E:Exception do
      begin
        showmessage('ERROR ' + E.Message);
      end;
end;


Raul
Image