example8: the combine action

posted in: Uncategorized | 0

For this next example we will show you how exactly the combine results works when you are using the ‘looking for xxxx’ action. Let’s create a rule that would create a monthly newsletter with the featured listings. To do this we will need to:

-fire this rule once a month, every month.

-look for all listings that have IsFeatured == true by using the filter pattern

-combine all these results into 1 variable

-mail this new variable out

So to start with the first part. Open the timed triggers and select the monthly recurring event action

Image 114

Image 115

Select the first day of the month, at 8AM00. If you’ve been following all the previous examples then by this time you should start to realize how easy it is to create rules in app-stitch.

Image 116

Just like before, select the Then action. For the second step we want to look for the listings that are featured. To do this, we will use the filter pattern to filter out all listings that are currently featured. So open the application data channel and select the look for an existing listing action.

Image 118

Image 119

Now we need to complete the filter pattern. Click on the variables button and open the listing entity. Scroll down until you find the IsFeatured variable and click it to add it to the filter pattern text box.

Image 120

Finish the formula by adding ‘==true’ to it. This way we can filter out only the listings that are featured. Click on accept propeties in the bottom right corner to continue.

Image 121

In case you missed the previous examples, here’s a quick recap of the different possible action types there are when using the ‘look for xxxx’ action:

-No results:

This will fire the next part of the rule only when there are no result. with this you could configure the rule that if there are no listings featured or have more than 5 bathrooms then send a mail saying ‘there are no featured listings today’.

-One or more results:

When using this action type, the next part of the rule will only be executed when there is at least one result. In the ‘no results option’ and in this option you will not be able to access the variables of the listings because you are talking about the collection of listings and not individual listings. You could for example configure the rule to send a mail when there is at least 1 result saying ‘there are featured listings today’.

-For each

Unlike the previous two options the for each options loops over the collection of results. So the next part of the rule will be executed for every result individualy, and we are no longer talking about the total collection. Because we are using the individual results again we can use the variables from the listings again. You can for example configure the rule to send a mail for each result saying the name (listing.Name variable) of the listing.


This will combine all the individual results into a single chain and store it into a new variable. You have to select which part of each result you want to use and what you want string you want to use to glue them together. Example: use the combine option to make a new variable that contains all the Names of the featured listings with a comma between them. Then you can use this result in a mail to show all the featured listings of that day.

For this example we want to show you how to use the combine action type to combine all the results into 1 variable that can be used later (to send in a mail).

Image 122

Now you will see there are some extra things that need to be completed. Because app-stitch needs to know exactly what part of the result we want to use. For this newsletter use the Name (variable) of the listing, followed by the word ‘in’ and then add the country (variable) of the listing. Glue all of this together with a comma. This means that between all listings a comma will be added.

Image 123

Now all we have to do is send this result in a mail, so click the email channel. For this example we will use the gmail channel but feel free to use any other channel you like.

Image 124

Image 125

Fill out your information and the receiver information. As a subject for this mail you can put something like ‘Monthly newsletter’. In the body of the mail put the result of the query, which is the name and country of all featured listings. Click on the variable button next to the Body property and open the ‘Look for an existing listing’ action in the variable screen. You will see that there is a new variable available called combined result. This will be what you stored earlier. So select it.

Image 126

Finish by typing a little introduction for you newsletter. and click on accept properties when ready

Image 127

Lastly, click on the finish rule button and give the rule an appropriate Name and Description so that you can later easily find out what this rule was for. Now all that is left to do, is wait for the first of the month to arrive!

Image 128

Image 129


– application link
– Intro: sample application tour
– rule 1: Authorizing who can continue to create a new record 
– rule 2: Understanding variables
– rule 3: Set a default value on new records
– rule 4: introducing channels
 rule 5: recap: audit
– rule 6: time channel, mail channel and new action types
– rule 7: audit when rule fired
– rule 8: Make a newsletter.