Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

compare two strings in multirow tool

pgayath1
8 - Asteroid

I need to compare whether same data is available in a column (Part_code_Trimmed) and group them using Multi-row tool. Please check whether the below statement is right 

 

 

if [Row-1:Part_Code_Trimmed] == [Row+1:Part_Code_Trimmed] then [Part_Code_Trimmed] else [Row-1:Part_Plus1]+1 endif 

 

thank you.

 

Error thrown: type mismatch in operator '+'

3 REPLIES 3
Thableaus
17 - Castor
17 - Castor

Hi @pgayath1

 

Your [Part_Plus1] field is probably a string. 

You need to convert it to an Integer. Use the select tool for that.

 

Cheers,

Kenda
16 - Nebula
16 - Nebula

@pgayath1 If you don't permanently want to change your field to a numeric one, another option would be to use the tonumber() function within your expression. 

mceleavey
17 - Castor
17 - Castor

Hi @pgayath1,

 

The error is because you are comparing two strings in what I take would be a string field, but one of the outcomes returns a numeric calculation.

Try:

 

if [Row-1:Part_Code_Trimmed] == [Row+1:Part_Code_Trimmed] then [Part_Code_Trimmed] else tonumber([Row-1:Part_Plus1])+1 endif

 

Ensure the multi-row formula you are creating is of a string type. You can then convert this field using a select tool if required.

 

Hope this helps.

 

M.



Bulien

Labels