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.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
crionsynx
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?
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.