Calculated field is not editable in dbgrid

Asked

Viewed 249 times

0

I have a DBGrid, one FDQuery and a DataSource that bring values from a table. In this FDQuery I created a calculated field of the type Integer called mult. The purpose of this field is for the user to write the multiplier value in the grid. The problem is that in the field of DBGrid He won’t let you type, just blink the dial:

Multiplicador não recebe caracteres

I’ve checked the settings on DBGrid and it’s editable, I checked the field, but I have no idea what the reason for this problem is. Can anyone tell me how to solve?

  • You don’t have the property readonly = true?

  • So I checked this too, and it’s not true, I tried several times to enable and disable to see if it was bug...

  • Good afternoon Felipe.. Dear the CALCULATED FIELD is to show something and not to be typed. As far as I know you will not achieve your goal this way.

  • Ricardo, thanks for the tip my dear, you are correct, I was doing wrong even...fixed the problem and finally understood the concept rs.

1 answer

0


If it must be typed, the field cannot be computed. It has to be a data field. If the dataset is the result of a query, you can select a fixed value, for example: SELECT 1 AS MULTIPLICADOR... This field is editable at runtime. It is important to clear the providerflags property of the field object, so that the datasetprovider does not attempt to update it in the database (if using clientdataset). Another possibility is to create the field object, with Fieldkink = fkData. This can be done by code, or simply from the Fieldseditor menu, choose new field, with field type = data.

  • Thank you very much Mr Ricardo, helped a lot in this concept, I managed to solve my problem by creating a field with alias and cleaning the providerflags. About the second possibility, I am using firedac, but when creating the field of type date it showed "catastrophic error" rs, well I did not go into it, but when finishing the project I will study this concept as well. See you around.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.