Simple computed field in a table bug?

Hello.I’ve created the simple form which contains a table with 2 rows to show what is the problem.

In first row i put the following fields:

“Price” - number, editable, default value = 2

“Qty” - number, editable, default value = 1

“Cost” - number, computed for display (I’ve tried computed as well)

I use Price*Qty formula for Cost value. Hard to imagine anything simpler. And it works fine uless Price, Cost and Qty placed in one cell.

Then I move Qty to another cell(second row) don’t ask me why.

Now when I’m trying to run the form I’m getting

“Field “Cost” incorrect data type for operator or @Function Number expected”

I’ve tried @IsError and @TextToNumber, @GetField, @If and more and more difficult combinations of this functions in value formula, until I realized it’s waste of time. Computed field value formula just don’t see Qty field if it’s in another row.

Same for all arifmetic operations.

However, if I use computed field just to display value from another cell it works properly.

I can’t mention any point of documentation, which would say computed field should be in the same cell with fields it uses in value formula.

Form created with 8.5.1 designer and tested with 8.5.1 and 7.0.3

Correct me if it’s not 8.5.1 bug.

Subject: Works OK for me

Sounds like a strange problem. I created a new form, table and fields like you specified and the quantity field calculated fine regardless of whether it was in the same cell, a different row or outside of the table.

Have you tried creating your table in a new blank database to see if it’s reproducible? I’ve had some strange issues in the past that seemed to be related to something in the form or db. Weird.

Good luck.

Subject: Thank you for your responces.

Yes, Mike.It’s reproducible. In blank databases and in Designer 7.0.3.

Renaud,you are right if I place Qty field above the table value formula workes out. The sequential method of computing fields in Notes form is novelty for me. Editable and computed field section of help doesn’t mention about it.

However it mentions about “Compute after validation” property. And turning it on for Cost field also doesn’t helps to make it work when Qty field is below Cost(or for example on the next Tab).

So I’m unclear with one more thing : Are fields on the Notes form validated before evaluated?

Subject: Compute time and validation time

As far as I know, computed and computed for display are evaluated when you open the document if the field as no value and when you refresh the document. It’s also done when you save the document, because a refresh is done at save time.

Validation occurs only when the document is refreshed.

And in your case the error is raised when it set the default value as it’s a new document => compute after validation doesn’t help.

Hope this makes things a bit clearer ! :wink:

Renaud

Subject: Thank you

Renaud.It’s much clearer now. !@IsNewDoc and Compute after validation can be used, to avoid error on first form opening.

Subject: Fields evaluation order

Fields are evaluated from left to right and from top to bottom.

So you probably have your “cost” field before “price” and/or “quantity” field.

With this “configuration”, when you create a new document, at least one of the value you multiply equals to an empty string because the field was not evaluated yet because he’s placed “later” in the document=> you get the message “incorrect data type for operator or @Function Number expected”.

So you must either put the cost fields after the price and quantity fields or check if price and quantity field value equals to an empty string to handle the error of the initial value evaluation.

Renaud