Testing grain size percentages adding up to 100

Hello,

I want to flag the grain size percentages if they don't add up to 100%.  I've added an entity on the log that will print the total percent (in red) only if it doesn't add up to 100%.  Right now, it will only work if all of the percentage fields have data in them.  How do I get it to recognize a blank field as equal to zero (0)?

Or maybe the simpler question is:  how can I flag the grain size percentages if they don't add up to 100%?

Thank you!

Parents
  • Hi Terry,

    You will want to to use the <<Val(expression)>> function. If the expression is empty, such as in a blank percentage field, Val will return 0 and prevent the entire calculation from failing.

    So, if your calculation is something like:

    <<Calc(<<Table.Percentage1>> + <<Table.Percentage2>> + <<Table.Percentage3>>)>>

    you'd want to change it to:

    <<Calc(<<Val(<<Table.Percentage1>>)>> + <<Val(<<Table.Percentage2>>)>>  + <<Val(<<Table.Percentage3>>)>> )>>

    For more info and examples, search for Val in gINT Help.

    Jesse

Reply
  • Hi Terry,

    You will want to to use the <<Val(expression)>> function. If the expression is empty, such as in a blank percentage field, Val will return 0 and prevent the entire calculation from failing.

    So, if your calculation is something like:

    <<Calc(<<Table.Percentage1>> + <<Table.Percentage2>> + <<Table.Percentage3>>)>>

    you'd want to change it to:

    <<Calc(<<Val(<<Table.Percentage1>>)>> + <<Val(<<Table.Percentage2>>)>>  + <<Val(<<Table.Percentage3>>)>> )>>

    For more info and examples, search for Val in gINT Help.

    Jesse

Children