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

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

ForEach formula expression in Alteryx

Atom

Is there a way to create an expression in Alteryx where it looks up conditions for each variable in a certain field.

 

Room ID

Category

A

Cat 1

A

Cat 3

A

Cat 4

B

Cat 1

B

Cat 2

 

So for example for the above table I want an alert to be raised if a specific room ID contains both Cat 1 and Cat 3.

Alteryx Certified Partner
Alteryx Certified Partner

Hi @GP2 

 

You can use either the Message Tool or the Formula tool with Message function.

 

See example:

 

message1212.PNG

 

 

You can see Designer actually left warnings when it found the records that you mentioned.

IF [Category] in ('Cat 1', 'Cat 3') THEN
Message(2, "Alert", "False")
ELSE "True" ENDIF

 

This goes to the log of your workflow.

 

The Message Function can be referenced here: https://help.alteryx.com/2018.2/Reference/Functions.htm

These are the message types:

 

  • 1 = Messages
  • 2 = Warnings
  • 3 = Errors
  • 5 = Conv Errors (field conversion errors)
  • 8 = Files (input)
  • 9 = Files (output)

Let us know if you have questions.

 

Cheers,

 

Alteryx Certified Partner

HI @GP2 ,

 

I've built a quick workflow which groups the categories by Room ID, and so you can see if Room A has both Categories:

 

Workflow.PNG

Depending on how you want to be alerted you can use the Messaging tool. I've used an email tool to send you an email if it happens.

 

Hope this helps.

 

M.

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@GP2 ,

 

I'd solve by searching the results of a Summarize (via concatenation) with this formula:

Contains([Concat_Category], "Cat 1") AND 
Contains([Concat_Category], "Cat 3")

capture.jpg

 

Cheers,

 

Mark 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Alteryx Partner

Hello @GP2 ,

 

Hope this helps!

 

Cheers

Labels