How to use Run If


Badge +4

Hi guys, I'm doing a reminder workflow. I need to count the values in my DaysLeft column. I queried the list column DaysLeft and stored it in a variable which is HowManyDaysLeft. I want the workflow to send an email if the number in the DaysLeft column is from 3 to 0.  I managed to configure the Run if, if its equals a certain number it will send. But I seem to have trouble sending numbers from a range. I tried using OR but it still doesn't send the email even tho there are 3 and -2 on that column.  Please take a look at my configuration thank you. This is a site workflow btw.

My Query Configuration

My execute query list runs properly

My Run if configuration


12 replies

Userlevel 5
Badge +14

what's datatype of HowManyDaysLeft variable? text or number?

if so, then it holds just one, first reutned value (6).

since your query returns multiple items, you have to store result set into a collection-type variable.

then you have to set up a for each loop and iterate over the collection to evaluate every single element/value within the collection.

Userlevel 6
Badge +15

Hi there - 

Based on your Run If config, it looks like it should work.. but I do have a suggestion.

What about have it set "Where:..."

HowManyDaysLeft is GREATER THAN OR EQUAL TO 0

AND


HowManyDaysLeft is LESS THAN OR EQUAL TO 3

If you wanted to capture all the -2 etc days as well you'd just use the second one and not the first. 

However, can I make another suggestion to save you an entire workflow action?

In your Query List... 

Use your "Filter" capability to look at DaysLeft and only return those items with less than 3 in there. Then you can totally bypass this RunIf.  (Unless of course you're acting on all items you've brought back and just have a specific extra action / email for the ones with 3 or less days left.)

Let me know if you need any clarification.

Cheers,

rhia


E: Marian is totally right about needing to do a "for each" for the collection. However, if you use my second suggestion ("In your Query List...") you can bypass that as well until you send the emails.

Badge +4

Hi I created a collection variable DaysLeftCollect and the DaysLeftItem which is a single text line variable.

I used the Query List function to query the column and then store the data in to the DaysLeftCollec Collection variable

My configuration for the For each loop

This is how my Run If config looks like

This is my overall view, is this how it should look like?

Badge +4

Hi I can't seem to find the option "Less than" or "Greater than".

Userlevel 5
Badge +14

yes, that's better approach.

but you have to place run if into for each loop - you have top make check for each and every collection element. as well, outside of for each loop value of variable DaysLeftItem is not valid.

next, I would defined DaysLeftItem  as numeric varible, then in run if action you will be able to compare with 'less then' or 'greater then' operators.

Badge +4

Ah I see, so I just placed the Run If into for each loop. Is this correct? I also changed the DaysLeftItem to a numeric variable as well and managed to find the greater than options.

Userlevel 5
Badge +14

yes, this should be correct.

what's the outcome, do you already get notifications?

Badge +4

Hi, I'll let you know tomorrow, I don't have access to my laptop now. Thank you so much.

Badge +4

Yes, it works great thank you! happy.png

Badge +4

Hi Marian sorry to trouble you again. Ok so what I want to do now is to add the message in the "Description" column into my email notifications. I want the messages in that row to correspond to the DaysLeft Column. 

Example: When for that row, if the DaysLeft is 1, the email notification will send the message in the "Description" column from that corresponding row.

The Description message in the email notification must be the same row of the DaysLeft.

Userlevel 5
Badge +14

please start new question so that different topics don't make this thread confusing.

Badge +4

Hi I created a new topic, please do have a look at it thank you. It's a different question though, but it is a continuation of this workflow.

https://community.nintex.com/message/80911-how-to-stop-a-workflow-under-certain-conditions

Reply