Cannot divide text by a number

I’ve been using a procedure for a long time with no problems. I recently added a round( function to take care of the occasional rounding error. Now part of the procedure no longer works.

this test:


Where lvSpecRate is previously defined as a tab separated array, and gvSalesTax is defined as a number returns the expected numbers.

but when it the first put into a formula like this:

lvArSwiftSpec=lvArSpecial+¬+array(lvArNames,2,";")+¬+round(array(lvSpecRate,1,tab()),.01)+¬+ round(val(array(lvSpecRate,1,tab()))/gvSalesTax,.01)+¬+round((gvSalesTax-1),.01)

I get a “cannot divide text by a number” error.

The formula works fine when not using the array, which is the “normal” use, this is for nonstandard rates, the values of which are stored in a field and used to create the array lvSpecRate

The array( function always returns text. Wherever you have array(something,sep) change that to val(array(something,sep)) before you try to do any arithmetic with it.

Ok, I can see where that would cause an error now. I didn’t think of rounding as done by division, the error message threw me off.


The round( function is a custom function. round(number,step) is the same as (int((number/step)+0.5))*step. The error occurred when it tried to do the division.