insert record

Hi,

I have a db field: CustomerBankAccount.IBAN

But if that field is empty there has not been a recorded created.

I try it like this:

IF CustomerBankAccount.IBAN = ‘’ THEN

CustomerBankAccount.INSERT(FALSE);

But then I will get an error.

Thank you

Sorry, can’t get what it is you want to achieve. Do you the record not to be created if IBAN is empty? Or you do want it to be inserted, but unable to do?

When you call INSERT(FALSE) you just suppress the OnInsert trigger, but the record is inserted anyway.

And it would be nice to see the error message you are receiving.

There is a customer table. ANd a bank account table.

But the nice thing is that it creates a customer record(that is good). But it doesnt create a bank account record(what is also good) if the IBAN field is empty.

But anyway I get this error:

Tabel Bankrekening klant is reeds aanwezig. Velden en waarden: klantnr:=783720, code=’’

Unfortunately, I don’t read Dutch. But thanks to Google Translate I can guess that it says ‘Customer bank account already exists’. :slight_smile:

Meaning that the bank account with blank code for this customer is already inserted. Is it customized code that does the insert? Without code any attempt in solving this will be just guessing.

Actually,

I want to skip the code that insert the record if CustomerBankAccount.IBAN is empty. I try it like this:

IF CustomerBankAccount.IBAN = ‘’ THEN

CustomerBankAccoun.SKIP;

else

{

CustomerBankAccount.“Customer No.”:= “”.“No.”;

CustomerBankAccount.IBAN := (IBAN);

CustomerBankAccount.“SWIFT Code” := (Swift);

CustomerBankAccount.“SWIFT Code” := (Swift);

IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN

CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);

CustomerBankAccount.INSERT(TRUE);

CustomerBankAccount.SETFILTER(CustomerBankAccount.“Customer No.”, “”.“No.”);

}

But skip is not recognised.

IF CustomerBankAccount.IBAN = ‘’ THEN

CustomerBankAccoun.SKIP;

else

{

CustomerBankAccount.“Customer No.”:= “”.“No.”;

CustomerBankAccount.IBAN := (IBAN);

CustomerBankAccount.“SWIFT Code” := (Swift);

CustomerBankAccount.“SWIFT Code” := (Swift);

IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN

CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);

CustomerBankAccount.INSERT(TRUE);

CustomerBankAccount.SETFILTER(CustomerBankAccount.“Customer No.”, “”.“No.”);

}

Hi

The CustomerBankAccoun.SKIP; is only applied on reports.

I believe the problem is that you have an empty record on the table Customer Bank Account.

By empty record I mean that the field IBAN is empty.

Please open the table, and filter on the IBAN field with ‘’.

hi Niels,

Why Don’t You Write like this

If CustomerBankAccount <> ‘’ then Begin

CustomerBankAccount.“Customer No.”:= “”.“No.”;

CustomerBankAccount.IBAN := (IBAN);

CustomerBankAccount.“SWIFT Code” := (Swift);

CustomerBankAccount.“SWIFT Code” := (Swift);

IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN

CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);

CustomerBankAccount.INSERT(TRUE);

CustomerBankAccount.SETFILTER(CustomerBankAccount.“Customer No.”, “”.“No.”);

End;

ANd When Ever you are posting Question Please Mention Version…

Thank you…

Hi Niels

You can do like this

IF CustomerBankAccount.IBAN <> ‘’ THEN Begin

Your Code for insert

END;

It works Perfectly.

Thanks

Ravi

Hi Niels

Regarding Insert(False) it means that record will insert but without calling oninsert trigger()

Thanks

Ravi

Thank you for your answare.

I have it now like this:

IF CustomerBankAccount.IBAN <> ‘’ THEN BEGIN

CustomerBankAccount.“Customer No.”:= “”.“No.”;

CustomerBankAccount.IBAN := (IBAN);

CustomerBankAccount.“SWIFT Code” := (Swift);

//CustomerBankAccount.“SWIFT Code” := (Swift);

IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN

CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);

CustomerBankAccount.INSERT(TRUE);

END;

But If there is a IBAN number. It doesnt fill the IBAN field.

Thank you!! I just used this:

IF IBAN <> ‘’ THEN BEGIN

etc… and it works!!

Thank you!! I just used this:

IF IBAN <> ‘’ THEN BEGIN

etc… and it works!!

Happy to hear…Chers :slight_smile:

Happy to hear…Cheers :slight_smile: