You are viewing limited content. For full access, please sign in.

Question

Question

SUB function Forms

asked on May 5, 2016 Show version history

I can't see the input parameters for this function anywhere

Is there something that prevents this type of error from happening when one of the fields is blank? 

 

 

Is there a function definition for this anywhere?

0 0

Replies

replied on May 5, 2016

Are you using javascript or the forms 10 built in calculations capabilities.

Paste you code or formula below and it will usually get a response. More detail is better.

0 0
replied on May 6, 2016

It's the 10.1 build in calcualtions.

 

I am looking for the function call variables so my code would not be of help here.

0 0
replied on May 6, 2016

If you are trying to Add or Multiple fields together, you need to use the SUM or PRODUCT Functions in Forms 10 or you will see errors such as this when a field is empty. Reference errors can be a result of not being able to find the variable, improper bracketing or formula structure.

0 1
replied on May 15, 2016

Can you provide your formula here so that we can tell what part cause error? What field type of the two referenced field and what value of them when you get the calculation error?

0 0
replied on May 16, 2016

It's not an error. I am asking for specifically for the function definition as it is unpublished from what I can tell.

0 0
replied on May 16, 2016

The SUB function is to do subtraction between two numbers. In 10.0, if you use two currency fields as parameters for this function, then it will show "The field contains a calculation error" when one of the field is blank, no such error when use two number fields as parameters. This issue has been fixed in 10.1 for 10.1 will treat empty value as 0 for operators.

0 0
replied on January 20, 2017

I'm still running into this issue. I am running 10.1.0.642.

Here is a picture of my table

 

Here is a snap of my formula:

=SUB(INDEX(TRAVEL.Total_Expense_2,ROW()),INDEX(TRAVEL.GST_HST_2,ROW()))

Here is a snap of my error when 1 field is blank:

0 0
replied on August 31, 2017

I just attempted to get two currency fields to subtract from each other using the SUB option and kept getting the same error.  I ended up having to use SUM but multiply the 2nd value by -1 to get it to work as subtraction.

  •  =SUM(Currency1,PRODUCT(Currency2,-1))

 

Also, if SUB is something we can use, why isn't it in the help files?  Sure would be nice to see it in https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/FieldCalculations.htm along with anything else (like if there is a division option DIV?).  

1 0
replied on October 23, 2018 Show version history

I tried this but it is not calculating the product of "(variable, -1)".  Instead it is just spitting out "-1".  No calculation is occurring, obviously, since the value of variable_2 is 25, and 25*-1 does not equal -1.

Can we really not enter SUB(variable_1,variable_2) and have it subtract variable 2 from variable 1? 

As a work around, I can use SUM(variable_1,variable_2) provided that I force the submitter of the form to simply enter a negative number in  the variable_2 field by limiting the value to -1000 to 0, but that is not what we want.  We want it to subtract variable 2 from variable 1.  

 

Finally got it to work with this formula...

 

=SUB(INDEX(variable_74.New_DU,ROW()),INDEX(variable_74.Demo_DU,ROW()))

 

Now if I can just figure out why this worked... perhaps the answer is 42.

0 0
replied on October 23, 2018 Show version history

Hi Jess, the formulas that contain INDEX and for when the fields appear in a table.

If you fields are standalone then you are correct SUB(variable1,variable2).

Are the Variable fields Number fields or Single Line fields. I suggest you try number fields.

0 0
replied on October 23, 2018

Got it, table.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.