community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

compare two strings in multirow tool

Meteor

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 '+'

Alteryx Certified Partner
Alteryx Certified Partner

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,

Pulsar
Pulsar

@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. 

Highlighted
Alteryx Certified Partner

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.

Labels