### Title

Trouble With Calculations

### Post

I'm trying to make a couple of calculations, and I'm not sure what I'm doing wrong in the script. All my fields are in the same table, but when it goes to make the calculations, it either uses one field with reference or does nothing at all. I'm not certain if I also need to a georefresh button so that's it is certain to wait until all necessary information is included. (This is being done in a portal, in a TO table).

First calculation is division -both fields are number fields - and read:

"Price per Unit" = Div ( price per quantity ; units per )

Then, I want to take the average of the 6 most recent entries of the same field .I was originally going to make this field a summary field, selecting average of, but , as I need this field (called mean for z) to be referenced in a different portal, (say new field "portal 2 m" = look up of "mean for z" , but it will not read that value. If i do it as a regular number, it will; just not as a summary.

Again, I'm not sure if I need a refresh button or what is the best way for going about this. Appreciate any help!

I can't see enough detail in how you've set up your tables and relationships to offer much help. ON the one hand you say "all my fields are in one table", but then you describe a portal and an average of values in a portal--which means you have a relationship and possibly a portal filter involved here.

Div ( price per quantity ; units per ), BTW, is integer division. It returns the portion of the answer to the left of the decimal point and any fractional/decimal value is discarded.

Div ( 5 ; 2 ) = 2 It does not return 2.5. To get 2.5 you would use 5/2 instead of the Div function.