CASE
WHEN Charindex('-',[@field:BoxNumber],0) >= 1 THEN
Cast((
(Cast((Right([@field:BoxNumber], (Len([@field:BoxNumber])-Charindex('-', [@field:BoxNumber])))) AS int))
-
(Cast((Left([@field:BoxNumber], Charindex('-', [@field:BoxNumber])-1)) AS int))
+1
) AS varchar)
ELSE
'1'
END
I have the above code inserted in [BoxCount] formula datatype field to get the difference of two values from a single field ([BoxNumber]) if it has dash(-) in it else it should be set to one(1).
Below is an example. For the highlighted row, the result of the formula should be 2 - basically (35142-35141)+1.
When I checked it in the "Verify formula" button, caspio considered it as valid but when I tried saving it, caspio throws the below error.
What am I missing here?