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
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>