Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Trouble with the average function.

Elgen55
Level 2
Level 2

I am still having a problem getting my form to calculate an average the way it should.  On one form I did when I set up an formcalc to average ten places and not average any cell that is blank or null I used the [*] and works just fine, but on the next form that I did that only has three rows it includes the null cells even through I used the [*] function.  What am I doing wrong?

7 Replies
Magus069
Level 10
Level 10

if a cell is null value, it should consider this value as 0... anyhow you don't want it to get the average with a 0, you must validate the field to see if it's different then null

Elgen55
Level 2
Level 2

I guess I don't understand what you mean by validating the field, I thought that is what the [*] was supposed to do by not using the null cells.

Magus069
Level 10
Level 10

Okay, well make sure your avg function is being used in formcalc language

make sure your field is calculated readonly

and that you are in the calculate event of the field

and if all those are correct, can you show me your lines?

Elgen55
Level 2
Level 2

I hope I am getting this right.  The line is Avg(Row3.PSI,Row4.PSI,Row5.PSI[*])

Magus069
Level 10
Level 10

Do you have a dynamic or fixed dimension table?

Looks like you have a fixed dimension table here...

Using -> [*] is to specify each instances of that object inside the subform specified... Here if you have more than one PSI into Row5 it would work... But as I understand you have to write only Avg(Row3.PSI, Row4.PSI, Row4.PSI)

If you have a dynamic table and your row is only named Row1... each instances of the row would be Row1[0], Row1[1], Row1[2]

So in your Average function you would only write :

Avg(Row1[*].PSI) and it would return the average of each rows

Elgen55
Level 2
Level 2

Thank you I will give that a try.  I will try to make it a dynamic table and go from there.

Magus069
Level 10
Level 10

http://www.youtube.com/watch?v=X3uNKS7vbpQ

here is a video you can watch and learn how to do dynamic table and calculate fields inside