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.

DataControls

Foro público de Xailer en español
Responder
Ingo
Mensajes: 330
Registrado: Mié Jul 05, 2006 3:58 pm

DataControls

Mensaje por Ingo »

I can't go on with datasets and datacontrols. I need help!
A table with the fields BRUTTO, MWST and NETTO. NETTO will be calculated
with the values of NETTO and MWST :
METHOD calculate( ) CLASS TForm1
WITH OBJECT ::oDbf //the dataset
:Edit()
:NETTO:=:BRUTTO/(1+:MWST/100)
:Save()
:RefreshCurrent()
:UpdateControls()
END
RETURN Nil
After the calculation the DBBrowse contains the new NETTO value but not the
linked TDBMaskedit.
Try it with a record containing a zero NETTO by clicking on the
"calculate"-button.
I can assign the calculated value to the datacontrol
(oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
control automatically. But I don't know how? Who know it?
Adding a new record to the table over the form2 how can I initialize the
controls in form2 (here oMWst with the numeric value 16)?
Please look in the sample.
Thank you in advance
and Merry Christmas
Ingo


Attached files testdata.zip (3.7 KB)Â
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9463
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

DataControls

Mensaje por ignacio »

Ingo,
oDbf:AddCalcField( "CalcNetto", {|oField| oField:oDataSet:Brutto / ( 1 +
oField:oDataSet:Mwst / 100 ) } )
That's all you need to do. After executing this line the calculated field is
created and you can use on any datacontrol.
It seems you are completely mistaken on how calculated fields work. Please
revise the documentation. I attach with this Email your project with some
minor corrections.
Regards,
"Ingo" <ingo.jh@web.de> escribió en el mensaje
news:[email=43abf996@ozsrvnegro.ozlan.local...]43abf996@ozsrvnegro.ozlan.local...[/email]
>I can't go on with datasets and datacontrols. I need help!
>
> A table with the fields BRUTTO, MWST and NETTO. NETTO will be calculated
> with the values of NETTO and MWST :
>
> METHOD calculate( ) CLASS TForm1
> WITH OBJECT ::oDbf //the dataset
> :Edit()
> :NETTO:=:BRUTTO/(1+:MWST/100)
> :Save()
> :RefreshCurrent()
> :UpdateControls()
> END
> RETURN Nil
>
> After the calculation the DBBrowse contains the new NETTO value but not
> the
> linked TDBMaskedit.
> Try it with a record containing a zero NETTO by clicking on the
> "calculate"-button.
>
> I can assign the calculated value to the datacontrol
> (oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
> control automatically. But I don't know how? Who know it?
>
> Adding a new record to the table over the form2 how can I initialize the
> controls in form2 (here oMWst with the numeric value 16)?
>
> Please look in the sample.
>
> Thank you in advance
> and Merry Christmas
>
> Ingo
>
>
>


Attached files testdata.zip (3.5 KB)Â
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Ingo
Mensajes: 330
Registrado: Mié Jul 05, 2006 3:58 pm

DataControls

Mensaje por Ingo »

Ignacio,
I'm so sorry, you misunderstood my questions completely, my English is too
bad.
My sample and my question does not concern Xailers Calculated Field Object.
I build a very simple sample to show the problem. The problem I have with
the use of (the great) DataSet is to update the linked control when I
changed the value of the databasefield by code.
In the sample NETTO is a r e a l field in the database in that the
result of a (any) calculation will be written and saved into the database
file.
WITH OBJECT ::oDbf //the dataset
:Edit()
:NETTO:=:BRUTTO/(1+:MWST/100)
// here I write something into the buffer of the DataSet
// it could be any value - for example a value from an
// other database or - only in this sample -
// a calculated value
:Save()
// writing the contents of the buffer into the database
// is that correct?
END
Now I want to update the control (oNetto) of the form (oForm1) linked to the
database field NETTO.
"RefreshCurrent()" doesn't do it!
"UpdateControls()" doesn't do it!
My first question is:
How to update the control in the form after changing the value of the
databasefield by code??????
Please remember, that this has nothing to do with Xailers CalculatedField
object.
The 2nd question is:
How to initialize the controls in a form linked to a DataSet field object
after :AddNew() with default values????
I hope, I expressed myself now understandably and ask you for apology, if I
trouble you again,
Felices fiestas
Ingo
> Ingo,
>
> oDbf:AddCalcField( "CalcNetto", {|oField| oField:oDataSet:Brutto / ( 1 +
> oField:oDataSet:Mwst / 100 ) } )
>
> That's all you need to do. After executing this line the calculated field
> is created and you can use on any datacontrol.
>
> It seems you are completely mistaken on how calculated fields work. Please
> revise the documentation. I attach with this Email your project with some
> minor corrections.
>
> Regards,
>
> "Ingo" <ingo.jh@web.de> escribió en el mensaje
> news:[email=43abf996@ozsrvnegro.ozlan.local...]43abf996@ozsrvnegro.ozlan.local...[/email]
>>I can't go on with datasets and datacontrols. I need help!
>>
>> A table with the fields BRUTTO, MWST and NETTO. NETTO will be calculated
>> with the values of NETTO and MWST :
>>
>> METHOD calculate( ) CLASS TForm1
>> WITH OBJECT ::oDbf //the dataset
>> :Edit()
>> :NETTO:=:BRUTTO/(1+:MWST/100)
>> :Save()
>> :RefreshCurrent()
>> :UpdateControls()
>> END
>> RETURN Nil
>>
>> After the calculation the DBBrowse contains the new NETTO value but not
>> the
>> linked TDBMaskedit.
>> Try it with a record containing a zero NETTO by clicking on the
>> "calculate"-button.
>>
>> I can assign the calculated value to the datacontrol
>> (oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
>> control automatically. But I don't know how? Who know it?
>>
>> Adding a new record to the table over the form2 how can I initialize the
>> controls in form2 (here oMWst with the numeric value 16)?
>>
>> Please look in the sample.
>>
>> Thank you in advance
>> and Merry Christmas
>>
>> Ingo
>>
>>
>>
>
>
>
CapelSoft
Mensajes: 137
Registrado: Vie Jul 29, 2005 8:49 am
Ubicación: Valencia - España
Contactar:

DataControls

Mensaje por CapelSoft »

Ingo,
Try ,
> WITH OBJECT ::oDbf //the dataset
> :Edit()
> :NETTO:=:BRUTTO/(1+:MWST/100)
:netto:fieldput(:BRUTTO/(1+:MWST/100))
I didn't try it, but I hope it solves your question.
Regards and Merry Christmas!!
José Luis Capel
Ingo escribió:
> Ignacio,
>
> I'm so sorry, you misunderstood my questions completely, my English is too
> bad.
> My sample and my question does not concern Xailers Calculated Field Object.
> I build a very simple sample to show the problem. The problem I have with
> the use of (the great) DataSet is to update the linked control when I
> changed the value of the databasefield by code.
>
> In the sample NETTO is a r e a l field in the database in that the
> result of a (any) calculation will be written and saved into the database
> file.
>
> WITH OBJECT ::oDbf //the dataset
> :Edit()
> :NETTO:=:BRUTTO/(1+:MWST/100)
>
> // here I write something into the buffer of the DataSet
> // it could be any value - for example a value from an
> // other database or - only in this sample -
> // a calculated value
>
> :Save()
>
> // writing the contents of the buffer into the database
> // is that correct?
>
> END
>
> Now I want to update the control (oNetto) of the form (oForm1) linked to the
> database field NETTO.
> "RefreshCurrent()" doesn't do it!
> "UpdateControls()" doesn't do it!
>
> My first question is:
>
> How to update the control in the form after changing the value of the
> databasefield by code??????
>
> Please remember, that this has nothing to do with Xailers CalculatedField
> object.
>
> The 2nd question is:
>
> How to initialize the controls in a form linked to a DataSet field object
> after :AddNew() with default values????
>
> I hope, I expressed myself now understandably and ask you for apology, if I
> trouble you again,
>
> Felices fiestas
>
>
> Ingo
>
>
>>Ingo,
>>
>>oDbf:AddCalcField( "CalcNetto", {|oField| oField:oDataSet:Brutto / ( 1 +
>>oField:oDataSet:Mwst / 100 ) } )
>>
>>That's all you need to do. After executing this line the calculated field
>>is created and you can use on any datacontrol.
>>
>>It seems you are completely mistaken on how calculated fields work. Please
>>revise the documentation. I attach with this Email your project with some
>>minor corrections.
>>
>>Regards,
>>
>>"Ingo" <ingo.jh@web.de> escribió en el mensaje
>>news:[email=43abf996@ozsrvnegro.ozlan.local...]43abf996@ozsrvnegro.ozlan.local...[/email]
>>
>>>I can't go on with datasets and datacontrols. I need help!
>>>
>>>A table with the fields BRUTTO, MWST and NETTO. NETTO will be calculated
>>>with the values of NETTO and MWST :
>>>
>>>METHOD calculate( ) CLASS TForm1
>>>WITH OBJECT ::oDbf //the dataset
>>> :Edit()
>>> :NETTO:=:BRUTTO/(1+:MWST/100)
>>> :Save()
>>> :RefreshCurrent()
>>> :UpdateControls()
>>>END
>>>RETURN Nil
>>>
>>>After the calculation the DBBrowse contains the new NETTO value but not
>>>the
>>>linked TDBMaskedit.
>>>Try it with a record containing a zero NETTO by clicking on the
>>>"calculate"-button.
>>>
>>>I can assign the calculated value to the datacontrol
>>>(oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
>>>control automatically. But I don't know how? Who know it?
>>>
>>>Adding a new record to the table over the form2 how can I initialize the
>>>controls in form2 (here oMWst with the numeric value 16)?
>>>
>>>Please look in the sample.
>>>
>>>Thank you in advance
>>>and Merry Christmas
>>>
>>>Ingo
>>>
>>>
>>>
>>
>>
>>
>
>
>
--
José Luis Capel
http://www.CapelBlog.es
Ingo
Mensajes: 330
Registrado: Mié Jul 05, 2006 3:58 pm

DataControls

Mensaje por Ingo »

José Luis,
thank you for your answer, but it doesn't work:
The problem is not to change the value of the database field, it is changed
correctly with my code.
WITH OBJECT ::oDbf //the dataset
:Edit()
:NETTO:=:BRUTTO/(1+:MWST/100)
:Save()
END
The question is why the TDBMaskEdit control linked to DataSet fieldobject is
not updated automatically.
I inserted ":UpdateControls()" after :Save() but the linked control will not
be updated, although the documentation says:
TDataSet:UpdateControls
Refreshes all the Datacontrols linked to the TDataSet through its
aLinkedControls array
Type
Only usable with open TDataSet
Parameters
None
Return value
NIL
What is wrong with my code?
Merry Christmas
Ingo
"José Luis Capel" <capelsoft@terra.es> schrieb im Newsbeitrag
news:[email=43ad0310@ozsrvnegro.ozlan.local...]43ad0310@ozsrvnegro.ozlan.local...[/email]
> Ingo,
>
> Try ,
>
>
> > WITH OBJECT ::oDbf //the dataset
> > :Edit()
> > :NETTO:=:BRUTTO/(1+:MWST/100)
>
> :netto:fieldput(:BRUTTO/(1+:MWST/100))
>
> I didn't try it, but I hope it solves your question.
>
> Regards and Merry Christmas!!
> José Luis Capel
>
>
> Ingo escribió:
>> Ignacio,
>>
>> I'm so sorry, you misunderstood my questions completely, my English is
>> too
>> bad.
>> My sample and my question does not concern Xailers Calculated Field
>> Object.
>> I build a very simple sample to show the problem. The problem I have with
>> the use of (the great) DataSet is to update the linked control when I
>> changed the value of the databasefield by code.
>>
>> In the sample NETTO is a r e a l field in the database in that the
>> result of a (any) calculation will be written and saved into the database
>> file.
>>
>> WITH OBJECT ::oDbf //the dataset
>> :Edit()
>> :NETTO:=:BRUTTO/(1+:MWST/100)
>>
>> // here I write something into the buffer of the DataSet
>> // it could be any value - for example a value from an
>> // other database or - only in this sample -
>> // a calculated value
>>
>> :Save()
>>
>> // writing the contents of the buffer into the database
>> // is that correct?
>>
>> END
>>
>> Now I want to update the control (oNetto) of the form (oForm1) linked to
>> the
>> database field NETTO.
>> "RefreshCurrent()" doesn't do it!
>> "UpdateControls()" doesn't do it!
>>
>> My first question is:
>>
>> How to update the control in the form after changing the value of the
>> databasefield by code??????
>>
>> Please remember, that this has nothing to do with Xailers CalculatedField
>> object.
>>
>> The 2nd question is:
>>
>> How to initialize the controls in a form linked to a DataSet field object
>> after :AddNew() with default values????
>>
>> I hope, I expressed myself now understandably and ask you for apology, if
>> I
>> trouble you again,
>>
>> Felices fiestas
>>
>>
>> Ingo
>>
>>
>>>Ingo,
>>>
>>>oDbf:AddCalcField( "CalcNetto", {|oField| oField:oDataSet:Brutto / ( 1 +
>>>oField:oDataSet:Mwst / 100 ) } )
>>>
>>>That's all you need to do. After executing this line the calculated field
>>>is created and you can use on any datacontrol.
>>>
>>>It seems you are completely mistaken on how calculated fields work.
>>>Please
>>>revise the documentation. I attach with this Email your project with
>>>some
>>>minor corrections.
>>>
>>>Regards,
>>>
>>>"Ingo" <ingo.jh@web.de> escribió en el mensaje
>>>news:[email=43abf996@ozsrvnegro.ozlan.local...]43abf996@ozsrvnegro.ozlan.local...[/email]
>>>
>>>>I can't go on with datasets and datacontrols. I need help!
>>>>
>>>>A table with the fields BRUTTO, MWST and NETTO. NETTO will be calculated
>>>>with the values of NETTO and MWST :
>>>>
>>>>METHOD calculate( ) CLASS TForm1
>>>>WITH OBJECT ::oDbf //the dataset
>>>> :Edit()
>>>> :NETTO:=:BRUTTO/(1+:MWST/100)
>>>> :Save()
>>>> :RefreshCurrent()
>>>> :UpdateControls()
>>>>END
>>>>RETURN Nil
>>>>
>>>>After the calculation the DBBrowse contains the new NETTO value but not
>>>>the
>>>>linked TDBMaskedit.
>>>>Try it with a record containing a zero NETTO by clicking on the
>>>>"calculate"-button.
>>>>
>>>>I can assign the calculated value to the datacontrol
>>>>(oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
>>>>control automatically. But I don't know how? Who know it?
>>>>
>>>>Adding a new record to the table over the form2 how can I initialize the
>>>>controls in form2 (here oMWst with the numeric value 16)?
>>>>
>>>>Please look in the sample.
>>>>
>>>>Thank you in advance
>>>>and Merry Christmas
>>>>
>>>>Ingo
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
_support_
Mensajes: 146
Registrado: Lun Abr 10, 2006 1:29 pm

DataControls

Mensaje por _support_ »

Ingo,
You are right. Problem fixed. Thank you very much.
Regards,
"Ingo" <ingo.jh@web.de> escribió en el mensaje
news:43ad19b9$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
> José Luis,
>
> thank you for your answer, but it doesn't work:
>
> The problem is not to change the value of the database field, it is
> changed correctly with my code.
> WITH OBJECT ::oDbf //the dataset
> :Edit()
> :NETTO:=:BRUTTO/(1+:MWST/100)
> :Save()
> END
>
> The question is why the TDBMaskEdit control linked to DataSet fieldobject
> is not updated automatically.
> I inserted ":UpdateControls()" after :Save() but the linked control will
> not be updated, although the documentation says:
>
> TDataSet:UpdateControls
>
> Refreshes all the Datacontrols linked to the TDataSet through its
> aLinkedControls array
>
>
> Type
> Only usable with open TDataSet
>
> Parameters
> None
>
> Return value
> NIL
>
>
>
>
> What is wrong with my code?
>
> Merry Christmas
>
> Ingo
>
> "José Luis Capel" <capelsoft@terra.es> schrieb im Newsbeitrag
> news:[email=43ad0310@ozsrvnegro.ozlan.local...]43ad0310@ozsrvnegro.ozlan.local...[/email]
>> Ingo,
>>
>> Try ,
>>
>>
>> > WITH OBJECT ::oDbf //the dataset
>> > :Edit()
>> > :NETTO:=:BRUTTO/(1+:MWST/100)
>>
>> :netto:fieldput(:BRUTTO/(1+:MWST/100))
>>
>> I didn't try it, but I hope it solves your question.
>>
>> Regards and Merry Christmas!!
>> José Luis Capel
>>
>>
>> Ingo escribió:
>>> Ignacio,
>>>
>>> I'm so sorry, you misunderstood my questions completely, my English is
>>> too
>>> bad.
>>> My sample and my question does not concern Xailers Calculated Field
>>> Object.
>>> I build a very simple sample to show the problem. The problem I have
>>> with
>>> the use of (the great) DataSet is to update the linked control when I
>>> changed the value of the databasefield by code.
>>>
>>> In the sample NETTO is a r e a l field in the database in that the
>>> result of a (any) calculation will be written and saved into the
>>> database
>>> file.
>>>
>>> WITH OBJECT ::oDbf //the dataset
>>> :Edit()
>>> :NETTO:=:BRUTTO/(1+:MWST/100)
>>>
>>> // here I write something into the buffer of the DataSet
>>> // it could be any value - for example a value from an
>>> // other database or - only in this sample -
>>> // a calculated value
>>>
>>> :Save()
>>>
>>> // writing the contents of the buffer into the database
>>> // is that correct?
>>>
>>> END
>>>
>>> Now I want to update the control (oNetto) of the form (oForm1) linked to
>>> the
>>> database field NETTO.
>>> "RefreshCurrent()" doesn't do it!
>>> "UpdateControls()" doesn't do it!
>>>
>>> My first question is:
>>>
>>> How to update the control in the form after changing the value of the
>>> databasefield by code??????
>>>
>>> Please remember, that this has nothing to do with Xailers
>>> CalculatedField object.
>>>
>>> The 2nd question is:
>>>
>>> How to initialize the controls in a form linked to a DataSet field
>>> object
>>> after :AddNew() with default values????
>>>
>>> I hope, I expressed myself now understandably and ask you for apology,
>>> if I
>>> trouble you again,
>>>
>>> Felices fiestas
>>>
>>>
>>> Ingo
>>>
>>>
>>>>Ingo,
>>>>
>>>>oDbf:AddCalcField( "CalcNetto", {|oField| oField:oDataSet:Brutto / ( 1 +
>>>>oField:oDataSet:Mwst / 100 ) } )
>>>>
>>>>That's all you need to do. After executing this line the calculated
>>>>field
>>>>is created and you can use on any datacontrol.
>>>>
>>>>It seems you are completely mistaken on how calculated fields work.
>>>>Please
>>>>revise the documentation. I attach with this Email your project with
>>>>some
>>>>minor corrections.
>>>>
>>>>Regards,
>>>>
>>>>"Ingo" <ingo.jh@web.de> escribió en el mensaje
>>>>news:[email=43abf996@ozsrvnegro.ozlan.local...]43abf996@ozsrvnegro.ozlan.local...[/email]
>>>>
>>>>>I can't go on with datasets and datacontrols. I need help!
>>>>>
>>>>>A table with the fields BRUTTO, MWST and NETTO. NETTO will be
>>>>>calculated
>>>>>with the values of NETTO and MWST :
>>>>>
>>>>>METHOD calculate( ) CLASS TForm1
>>>>>WITH OBJECT ::oDbf //the dataset
>>>>> :Edit()
>>>>> :NETTO:=:BRUTTO/(1+:MWST/100)
>>>>> :Save()
>>>>> :RefreshCurrent()
>>>>> :UpdateControls()
>>>>>END
>>>>>RETURN Nil
>>>>>
>>>>>After the calculation the DBBrowse contains the new NETTO value but not
>>>>>the
>>>>>linked TDBMaskedit.
>>>>>Try it with a record containing a zero NETTO by clicking on the
>>>>>"calculate"-button.
>>>>>
>>>>>I can assign the calculated value to the datacontrol
>>>>>(oNetto:Value:=::oDbf:NETTO) but I think there is a way to refresh the
>>>>>control automatically. But I don't know how? Who know it?
>>>>>
>>>>>Adding a new record to the table over the form2 how can I initialize
>>>>>the
>>>>>controls in form2 (here oMWst with the numeric value 16)?
>>>>>
>>>>>Please look in the sample.
>>>>>
>>>>>Thank you in advance
>>>>>and Merry Christmas
>>>>>
>>>>>Ingo
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>
Responder