TSeba Posted July 27, 2018 Share Posted July 27, 2018 Hi, I have an error detected using UniDbGrid (TUniDbGrid) related to an Interbase table. Also I am using Delphi 10.2 Tokyo with Unigui version 10.0.1472. In a column where Integer type values are loaded (the same happens with Float type fields), if I insert the value 0 (zero) when validating the previous record of its insertion in the table, the IsNull function returns the value True. The exact validation done in the BeforePost event of the table is as follows: 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 of the IsNull function returns TRUE. If 0.01 is reported (or any value other than 0) the IsNull function returns FALSE. I did the same test using DbGrid (TDbGrid) and the "IsNull" function worked correctly returning TRUE if nothing was actually entered in the column and FALSE if 0 (zero) was loaded so the problem is not at the database level. In this case I am not using querys but I use the TIBCTable and TIBCDataSource components of Devart. Thanks in advance Link to comment Share on other sites More sharing options...
Ron Posted July 28, 2018 Share Posted July 28, 2018 What if you set the default value of that field to 0, at the DB level, and drop that validation? Link to comment Share on other sites More sharing options...
TSeba Posted July 30, 2018 Author Share Posted July 30, 2018 Thanks for the reply. It is a possibility but I have similar validations in several tables and it would imply changing them all and in this case it would not be the best solution. Thanks Link to comment Share on other sites More sharing options...
Ron Posted July 30, 2018 Share Posted July 30, 2018 It is a possibility but I have similar validations in several tables and it would imply changing them all and in this case it would not be the best solution. That is what batch SQL is for If 3 minutes of copy & paste can save me 3 days of trouble, I am all in. Link to comment Share on other sites More sharing options...
TSeba Posted July 31, 2018 Author Share Posted July 31, 2018 Totally agree... In my case they are validations using the IsNull function but in different tables with Integer fields I have to verify if something was reported or not. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now