Why is my table calculation expression reporting an argument type must match error message?

Knowledge Drop

Last tested: Jan 21, 2019
 

This can happen when creating an IF( ) statement in Table Calculations that have different datatype results. For example:

if(row()=1,"row 1",

if(row()=2,"row 2",

${order_items.count}))

Where order_items.count is an integer value, but the other IF conditions output strings like row 1 or row 2. To resolve this we need to ensure that all data type outputs of the IF statement match. This is very similar to how a CASE WHEN will work in SQL.
if(row()=1,"row 1",

if(row()=2,"row 2",

"else string value"))

or

if(row()=1,1,

if(row()=2,2,

${order_items.count}))

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:01 AM
Updated by: