CASE WHEN {subsidiary.parent} = {subsidiary} THEN ...
# ask-stanley-ai
w
CASE WHEN {subsidiary.parent} = {subsidiary} THEN 1 ELSE 0 END gives me followng error Illegal argument: You cannot combine STRING and INTEGER values in the same CASE WHEN statement or output type of a formula definition. (Error on line 1 column 1.)
c
AI generated answer (using internal Slack threads):
The error you're encountering is due to the fact that you're trying to combine different data types in the same CASE WHEN statement. In your formula, you're comparing a string
{subsidiary.parent}
with
{subsidiary}
and then trying to return an integer (1 or 0) based on the result of this comparison. In NetSuite, the CASE WHEN statement must return the same data type in both the THEN and ELSE parts. If you're comparing strings, then both the THEN and ELSE parts must return a string. If you're comparing integers, then both the THEN and ELSE parts must return an integer. To fix this, you could convert the integer to a string using the TO_CHAR function. Here's an example of how you could modify your formula:
Copy code
CASE WHEN {subsidiary.parent} = {subsidiary} THEN '1' ELSE '0' END
In this modified formula, both the THEN and ELSE parts return a string, which should resolve the error you're seeing. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.882690489
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838134766
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833923399
Please provide your feedback on this answer.