In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Saving a Dbf Dataset CalculatedField ....
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
I am using a Dbf Dataset CalculatedField to retrieve and then edit memo text that I store in a separate memo text dbf using simple 100 character text records with suitable fields for indexes for retrieval.
The CalculatedField retrieves the data from the memo text dbf OK ... GOOD.
When the edit has been done I want to SAVE the TDbMemo contents to my memo text system. The Xailer help suggests using OnSetValue event.
See CalculatedField 1 image. The problem for me is that this event is triggered on every keypress ... I want something triggered on the SAVE.
See CalculatedField 2 image. I already have my own DbfDatSet class inherited from TDbfDataSet and can override the save() method. I have access to the Calculated Field here but I need the contents of that field to pass to my memo text save functions.
The image shows that I do have the calculated field but that :Buffer and :Value do not have the contents.
How can I get the contents please.
Any help would be really appreciated.
Chris
Attached files
The CalculatedField retrieves the data from the memo text dbf OK ... GOOD.
When the edit has been done I want to SAVE the TDbMemo contents to my memo text system. The Xailer help suggests using OnSetValue event.
See CalculatedField 1 image. The problem for me is that this event is triggered on every keypress ... I want something triggered on the SAVE.
See CalculatedField 2 image. I already have my own DbfDatSet class inherited from TDbfDataSet and can override the save() method. I have access to the Calculated Field here but I need the contents of that field to pass to my memo text save functions.
The image shows that I do have the calculated field but that :Buffer and :Value do not have the contents.
How can I get the contents please.
Any help would be really appreciated.
Chris
Attached files
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
Chris,
Check the event TDataField:OnSetValue()
Regards,
Check the event TDataField:OnSetValue()
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
Thank you for being on the case.
I feel I am using the Calcualted Field :OnSetValue event already but find that it is actioned on every key press from the linked TDbMemo control.
The attached image shows this ... have added some extra words.
When the Navigator 'Tick' is pressed the :OnSetValue event is actioned again and it does give me the final value which would allow me to save the text using my memo storage functions.
My problem is that the event is actioned by every keypress in the TDbMemo and if I am not careful I will save the text every time a key is pressed also.
Maybe I can detect in the OnSetValue event that it is being actioned as a result of a keypress from the TDbEdit and ignore it, and only save the text when it is after the Navigator 'Tick' action.
For instance is there a TDbfDataSet mode saying 'update' after the tick is pressed?
Maybe I am missing something, quite likely.
Chris
Attached files
Thank you for being on the case.
I feel I am using the Calcualted Field :OnSetValue event already but find that it is actioned on every key press from the linked TDbMemo control.
The attached image shows this ... have added some extra words.
When the Navigator 'Tick' is pressed the :OnSetValue event is actioned again and it does give me the final value which would allow me to save the text using my memo storage functions.
My problem is that the event is actioned by every keypress in the TDbMemo and if I am not careful I will save the text every time a key is pressed also.
Maybe I can detect in the OnSetValue event that it is being actioned as a result of a keypress from the TDbEdit and ignore it, and only save the text when it is after the Navigator 'Tick' action.
For instance is there a TDbfDataSet mode saying 'update' after the tick is pressed?
Maybe I am missing something, quite likely.
Chris
Attached files
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Ignacio,
I uploaded the wrong image on that last message.
Please take a look at this one.
Chris
Attached files
I uploaded the wrong image on that last message.
Please take a look at this one.
Chris
Attached files
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
Chris,
All the datacontrols are saved into memory (its value) every time a key is pressed. This is done to automatically update any other datacontrol that may use the same datafield. For example a TDBLabel and TDBEdit using the same field. Every time you a press a key on the edit field the label control is updated. This behavior can not be modified.
BTW, you can use the events TDataset:OnPreSave to get the value of any field with TDataField:Value or even overload the Update method on TDataset.
Regards,
All the datacontrols are saved into memory (its value) every time a key is pressed. This is done to automatically update any other datacontrol that may use the same datafield. For example a TDBLabel and TDBEdit using the same field. Every time you a press a key on the edit field the label control is updated. This behavior can not be modified.
BTW, you can use the events TDataset:OnPreSave to get the value of any field with TDataField:Value or even overload the Update method on TDataset.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
Thanks for the advice.
I am trying both TDataset:OnPreSave, or maybe TDataset:OnPostSave ... will decide which later.
But my oCalculatedField:VALUE seems to be empty inside of both Events.
I have used the debugger to inspect the oCalculatedField ... it shows VALUE is empty.
Maybe there is something I am doing wrong?
I think I am going to have to make a very simple test program if there is nothing obvious to you.
Chris
Thanks for the advice.
I am trying both TDataset:OnPreSave, or maybe TDataset:OnPostSave ... will decide which later.
But my oCalculatedField:VALUE seems to be empty inside of both Events.
I have used the debugger to inspect the oCalculatedField ... it shows VALUE is empty.
Maybe there is something I am doing wrong?
I think I am going to have to make a very simple test program if there is nothing obvious to you.
Chris
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
ChrisGillard escribió el lun, 03 diciembre 2012 16:42Hi Ignacio,
I think I am going to have to make a very simple test program if there is nothing obvious to you.
Chris
Ok. I'll wait for that.
Regards,
I think I am going to have to make a very simple test program if there is nothing obvious to you.
Chris
Ok. I'll wait for that.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
I think there is something I need to confirm with DBMemoEdit controls and Dataset calculated fields please.
If I have a Dataset object as usual ... MyDataset.
If I add a MyCalculatedField to that dataset using
MyDataSet:AddCalcField( "MEMOTEXT", { Block to seek and retrieve my memo text from another dbf } )
If I have MyDbMemoEdit on my form with :oDataSet set as "MEMOTEXT"
This works as I would expect ...... MyDbMemoEdit shows my memo text.
My problem is when I append/edit that text in MyDbMemoEdit control, say I use AddNew()....
I see the text I type in MyDbEditmemo control but I never get my text in the MyCalculatedField:VALUE or even in MyDataSet:MEMOTEXT
My suspcicion is that their is NO AUTOMATIC way of getting the text MyDbEditControl to the linked MyCalculatedField and MyDataset.
My suspicion is I have to use an MyDbMemoEdit:OnSETvalue event to do this linkage.
So a DbMemoEdit control does not update its linked oDataField for saving at all without using some code.
It would be good for me to really know this is the rule.
Thanks
Chris
I think there is something I need to confirm with DBMemoEdit controls and Dataset calculated fields please.
If I have a Dataset object as usual ... MyDataset.
If I add a MyCalculatedField to that dataset using
MyDataSet:AddCalcField( "MEMOTEXT", { Block to seek and retrieve my memo text from another dbf } )
If I have MyDbMemoEdit on my form with :oDataSet set as "MEMOTEXT"
This works as I would expect ...... MyDbMemoEdit shows my memo text.
My problem is when I append/edit that text in MyDbMemoEdit control, say I use AddNew()....
I see the text I type in MyDbEditmemo control but I never get my text in the MyCalculatedField:VALUE or even in MyDataSet:MEMOTEXT
My suspcicion is that their is NO AUTOMATIC way of getting the text MyDbEditControl to the linked MyCalculatedField and MyDataset.
My suspicion is I have to use an MyDbMemoEdit:OnSETvalue event to do this linkage.
So a DbMemoEdit control does not update its linked oDataField for saving at all without using some code.
It would be good for me to really know this is the rule.
Thanks
Chris
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
Hello,
I believe you are not setting TCalcField:OnSetValue correctly. I include with this message a Xailer modified to retrieve and save Calculated fields.
Keep in mind that calculated fields can NOT perform append or edit operations if you do not 'teach' them how to do it.
Regards,
Attached files DbfTest.zip (17.7 KB)Â
I believe you are not setting TCalcField:OnSetValue correctly. I include with this message a Xailer modified to retrieve and save Calculated fields.
Keep in mind that calculated fields can NOT perform append or edit operations if you do not 'teach' them how to do it.
Regards,
Attached files DbfTest.zip (17.7 KB)Â
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
Thanks for jumping in.
I will take a look at your code, thank you.
On point 2 ... Am happy that CalcFields need to be taught what to do. I have to do some stuff to save the memotext using my own functions to a separate text dbf.
I think my fundemental problem is getting the current MyDbfEditControl:Value. I was hoping that as you type into the Control the 'linked' MyCalcField:Value would also be updated with the typing.
I dont seem to ever get anything in MyCalcField:Value .... this is my main surprise.
If I am still struggling I really will have do come up with a simple test.
Thanks
Chris
Thanks for jumping in.
I will take a look at your code, thank you.
On point 2 ... Am happy that CalcFields need to be taught what to do. I have to do some stuff to save the memotext using my own functions to a separate text dbf.
I think my fundemental problem is getting the current MyDbfEditControl:Value. I was hoping that as you type into the Control the 'linked' MyCalcField:Value would also be updated with the typing.
I dont seem to ever get anything in MyCalcField:Value .... this is my main surprise.
If I am still struggling I really will have do come up with a simple test.
Thanks
Chris
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
Hello,
You have two events to do what ever you need on TDataField:
- OnGetValue
- OnsetValue
For example:
STATIC MyValue := ""
...
TDataField:OnSetValue := {|o, v| MyValue := v ) }
TDataField:OnGetValue := {|o| MyValue }
On this sample you are using the value of a static variable to save and retrieve the value.
Of course, TDataField:Value will always return the value of the static var MyValue.
Regards,
You have two events to do what ever you need on TDataField:
- OnGetValue
- OnsetValue
For example:
STATIC MyValue := ""
...
TDataField:OnSetValue := {|o, v| MyValue := v ) }
TDataField:OnGetValue := {|o| MyValue }
On this sample you are using the value of a static variable to save and retrieve the value.
Of course, TDataField:Value will always return the value of the static var MyValue.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
I have created a test program that is attached.
The most important code is in the method:
METHOD DBNavigator1ClickUpdate( oSender ) CLASS TForm1
I hope my notes in that method will show what I am trying to do and what does not work in the way I would like.
If I have not made it clear enough then I will give up and find an alternative way of doing things but I was hoping that oCalculatedField:Value or similar would do the job for me.
Please dont waste too much time or too many brain cells.
Thank you.
Chris
Attached files DbfCalculatedFields.zip (4.2 KB)Â
I have created a test program that is attached.
The most important code is in the method:
METHOD DBNavigator1ClickUpdate( oSender ) CLASS TForm1
I hope my notes in that method will show what I am trying to do and what does not work in the way I would like.
If I have not made it clear enough then I will give up and find an alternative way of doing things but I was hoping that oCalculatedField:Value or similar would do the job for me.
Please dont waste too much time or too many brain cells.
Thank you.
Chris
Attached files DbfCalculatedFields.zip (4.2 KB)Â
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Saving a Dbf Dataset CalculatedField ....
Hi Chris,
Sample modified to suite your needs attached.
Regards,
Attached files DbfCalculatedFields.zip (3.1 KB)Â
Sample modified to suite your needs attached.
Regards,
Attached files DbfCalculatedFields.zip (3.1 KB)Â
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Saving a Dbf Dataset CalculatedField ....
Hi Ignacio,
Thanks for that code using the static and the OnSetValue event.
I can see that it does work in this situation.
I will work that thinking into my code and see how it goes .... of course my situation is a little more complex with multi prgs etc, inherited TDbfDataSet etc.
I think for both our sanity I will call this closed ... but I will ask a simple question in another thread.
Thanks again
Chris
Thanks for that code using the static and the OnSetValue event.
I can see that it does work in this situation.
I will work that thinking into my code and see how it goes .... of course my situation is a little more complex with multi prgs etc, inherited TDbfDataSet etc.
I think for both our sanity I will call this closed ... but I will ask a simple question in another thread.
Thanks again
Chris