calculated field problem?

I see a few other folks are experiencing problems with calculated fields,
as am I.

I have a real simple form set up, where I type a number in a field
(“field #1”), and another field (“field #2”) is a calculated field that
just multiples the number in field #1 by 2.

when i enter a number in field #1, and tab, the calculation sometimes works!

when i enter a number in field #1 and click on the form, the calculation always works.

I’m very confused about this, and need to get it working, or find another way
to do what I need to do.

any help would be appreciated.
thanks.

rm.

I have tried to replicate this but was not able to do so… tabbing in and out a field int1 and int2 gave me a the expected result in a field int3… (BTW have you set all dataproviders to the correct type including the returned type of the calculated field)

Strange you don’t get that…

What you can do if this remains is try a controller.saveData() on the onDataChanged event of the field :? Maybe that helps

please send me an example soltuion where i can see that behaviour

Hi Robert,

Attached is a solution that does what you describe.
(without errors that is)
Could you please import this solution and see how it runs on your machine?

Can you also give me the version you’re working with?
I’m using:
Servoy Developer
Version R2 2.0 rc6-build 265
Java version 1.4.1_01-b01 (Windows 2000)

i think i have it narrowed down;

a ‘normal’ calcualted field with update when the
user changes something on a form, and leaves
the field he’s working on by hitting tab or clicking
elsewhere on the form.

calculations based on other calculations however,
will not update until the user clicks on the form.

tabing from field-to-field while entering data will
not work for these types of calculations.

does this help?

i just made an example and that works fine:

made a global: calcInput
made one calc (firstCalc) that returns calcInput+1
made a second calc that returns firstCalc +1

put the global on a form with a textfield
both calcs i displayed in 2 labels with the calcs as the dataprovider.

and it works fine if i change the global.
Isn’t this example working for you?

I’m also having a problem with calcs not updating:
form INVOICES, with a portal showing records from PROJECTS table (Project nr, date and difference, where difference is the remaining amount the customer still has to pay)
This calculation is given subtracting the sum of all invoices related to the current project from project’s total)
Let’s say my project is 150 euros
I move to invoices form and create a new invoice of 50 euros
when I click the button the assigns the project nr to this invoice, I would expect the difference field to be updated (in this case, become 100), but it doesn’t. I tried to click in the form, save data, go to a different record: nothing.
The value is updated only if I go to the Projects form and then I come back (I didn’t try to move to other forms)

please send an example then i can check it out.

I also just came across a calculation problem. I attached a solution that demonstrates my problem and saves me writing time.

In the attached solution there is a popup where you can choose A, B or C. The calculation that doesn’t update is right beneath and just “calculates” the chosen value.

Thanks.

Display issue will be fixed in Servoy 2.0 rc10, thanks for reporting!