Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Invalid type in operator

alexg1
8 - Asteroid

Hello,

 

As noted above, I've received an "Invalid type in operator" error for the following code:

 

IF findstring([DEPART/ARRIVE],substring([DEPART/ARRIVE],1,6))=substring([Row-1:DEPART/ARRIVE],1,6)

AND [DATE]=[Row-1:DATE]

AND [Stop?] = "1"

THEN [Stop?] = "0"

ELSE [Stop?] = "1"

ENDIF

 

Some quick searching says this tends to occur when there is a mismatch between string and numerical datatypes, hence the quotes around 1 and 0, but removing the quotes and using a Select tool to change them to INT16 does not appear to resolve the issue. I'm sure I'm missing something small, but any help would be appreciated.

5 REPLIES 5
JoeS
Alteryx
Alteryx

HI @alexg1 

 

It's the first line that's not quite correct. The error is with this part substring([DEPART/ARRIVE],1,6))=substring([Row-1:DEPART/ARRIVE],1,6)

Namely the equals that you have in there.

 

You have put a sub-query inside the find string.function.

 

Not quite sure what you are wanting to check there, are you wanting to see if its the same as the row before?

alexg1
8 - Asteroid

Hi Joe,

 

This is part of a multi-row formula. You are correct in that I want to compare it to the previous row and see if it is the same. The curveball here is that I only want to compare that specific substring. The rest of the string sometimes varies.

JoeS
Alteryx
Alteryx

In which case, do you need the find string part?

 

Or can you just check those 6 characters are the same?

 

IF substring([DEPART/ARRIVE],1,6))=substring([Row-1:DEPART/ARRIVE],1,6)
AND [DATE]=[Row-1:DATE]
AND [Stop?] = "1"
THEN [Stop?] = "0"
ELSE [Stop?] = "1"
ENDIF
alexg1
8 - Asteroid

Looks like I was over-complicating things, this did it.

 

Thank you!

JoeS
Alteryx
Alteryx

Great stuff, glad you got what you needed!

Labels