Create field only in Dataset with default value

Asked

Viewed 186 times

1

How I create a field in the ClientDataSet that is not in the database and I leave it with a default value?

I need a field like FLAG_EXEMPLO standard’S' only that I cannot create the same in the bank. It needs to be only in the DataSet.

I’ve tried to use Calculate and InternalCalc with AutoGenerateValue and Default Expression, but nothing seems to work. I don’t know if maybe I didn’t do it the right way.

  • You can post your code to get an idea?

  • Creates the field in Clientdataset as ftString, size 1, just after giving a Createdataset, assigns the default value to the field as’S' and no longer needs to change.

2 answers

0

You can do in SQL itself:

SELECT 'S' AS FLAG_EXEMPLO, CAMPO1, CAMPO2 FROM TABELA;
  • Then go to the dataset to mark the field as editable, or it marks it as Readonly with that sql. Then trying to change the value in the code will give error :)

-1

You can create fields on ClientDataset in Runtime, then you go to the properties of that field and inform that this field does not go to the bank, that is, when the ClientDataset generates the commands of insert and update, this field is not generated in SQL.

Browser other questions tagged

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