Hello,
I am trying to replace the True/False displayed by default in a DBAdvGrid linked to a boolean field with a Yes/No.
I have implemented the metod DBAdvGridCategoryListGetEditorProp in the following way:
case ACol of
5: begin
DBAdvGridCategoryList.ClearComboString;
DBAdvGridLinkCategoryActions.AddComboString('Yes');
DBAdvGridLinkCategoryActions.AddComboString('No');
end;
and the method DBAdvGridCategoryListGetEditorType in the following way:
case ACol of
5:AEditor:=edComboList;
end;
The yeses/nos are shown correctly but when I try to change the value I have an error message ('no', is not a valid boolean value for a field xxxxx)
I tried to implement the method procedure TFormCustomerCategoryManager:
case ACol of
5:begin
if Value='Yes' then
DataModule1.PgTable.FieldByName('xxx').AsBoolean:=true
else
DataModule1.PgTable.FieldByName('xxxxxxx').AsBoolean:=false;
but it doesn't work.
I have also looked into the samples but didn't find anything.
How can I fix it ?
Many thanks
Alberto
Sorry, the last method I implemented is DBAdvGridLinkCategoryActionsCellValidate
case ACol of
5:begin
if Value='Yes' then
DataModule1.PgTable.FieldByName('xxx').AsBoolean:=true
else
DataModule1.PgTable.FieldByName('xxxxxxx').AsBoolean:=false;
I tried this one and I can select the option yes/no correctly but when I try to move to another cell I have the EDatabaseError "no is not a valid boolean value for field xxxxx". It seems GetEditText designate Value to the db field.
I also tried to implement GetDisplText
How can I solve this ?
Many thanks
Alberto
What database do you connect to?
Normally, you would return the string values that you would normally use to update the DB field with
Hello Bruno,
My database is PostgreSQL. I did some tests. I ran the query UPDATE table SET fieldname='No'; directly from the console and everything works. That means PostgreSQL accept No/Yes as valid data for boolean fields.
Then I connected a fresh datasource+dataset to a normal DBGrid, typed "Yes" and I have the same error message I mention in my previous posts. That means the problem seems to reside in the Data Access Component I use to connect my application to PostgreSQL. I will address the issue to the other company.
Thank you very much for your help
Alberto