Function IsNull returns wrong value
Posted: Thu 26 Jul 2018 15:11
Hi,
I'm using a UniDbGrid that is related to an Interbase table. The UniDbGrid columns show the information of the fields in the table. When inserting a record in that grid and before inserting itself into the interbase table, a series of validations is made, one of those validations is that a field (In this case, Amount From) can be loaded amounts greater than or equal to 0 and is correct. These validations are executed before registering the record in the table
If TableName.FieldByName ('AmountFrom'). IsNull then
ShowMessage ("You must enter an amount greater than or equal to 0")
The problem is that if I charge amount = 0 the, when doing the previous validation I get the message that I must enter an amount because the IsNull function returns TRUE. This is not correct since the field has the value 0 and therefore is not null. If 0.01 is reported (or any value other than 0) the message does not appear because the IsNull function returns FALSE.
In this case I am not using querys but I use the TIBCTable and TIBCDataSource components.
Any idea how to fix this?.
Thanks in advance
I'm using a UniDbGrid that is related to an Interbase table. The UniDbGrid columns show the information of the fields in the table. When inserting a record in that grid and before inserting itself into the interbase table, a series of validations is made, one of those validations is that a field (In this case, Amount From) can be loaded amounts greater than or equal to 0 and is correct. These validations are executed before registering the record in the table
If TableName.FieldByName ('AmountFrom'). IsNull then
ShowMessage ("You must enter an amount greater than or equal to 0")
The problem is that if I charge amount = 0 the, when doing the previous validation I get the message that I must enter an amount because the IsNull function returns TRUE. This is not correct since the field has the value 0 and therefore is not null. If 0.01 is reported (or any value other than 0) the message does not appear because the IsNull function returns FALSE.
In this case I am not using querys but I use the TIBCTable and TIBCDataSource components.
Any idea how to fix this?.
Thanks in advance