Help with Looping Actions

Hi,

I have been getting trouble finding a solution that would fit for my scenario.  I am currently creating a basic app that would help us send reminders to our employees for their Annual Physical Examinations.

The app mostly revolves in 3 tables, which are as follows:
1. tblemployees - this holds all of the employee details
2. tblschedule - this holds the details of the schedule (it also contains a list where we select employees based on the birth month selected on the form when initiating the schedule).
3. tblempscheds - this should hold the the details for the employees about their schedule. 

When a schedule is created using the form for tblschedule, all selected employees with the same birth month selected, should be added inside the tblempscheds (as this will trigger the bot for the emails notifications)

This is how the form looks like:

Rhage_0-1705302660919.png

 

I tried following the Looping with actions, however it does not work and my app gets stuck for a reason.

Here is the action to create the items on the tblempsched

Rhage_1-1705302993501.pngRhage_2-1705303028625.pngRhage_3-1705303046612.png

The form save is using the Repeater action, then I was hoping that this would formula would loop all selected employees all the way: COUNT([Related tblempsched]) < [Count of Employees].


Any advise on how can I go over this? or any similar scenario I could base of from. Appreciate the help.

 

 

 



Solved Solved
0 11 234
1 ACCEPTED SOLUTION

You can use Start: & End together with SELECT() when adding rows with the webhook. It looks something like this (from an existing Bot). Yours will be more simple..

{
"Action": "Add",
"Properties": {
"Locale": "fi-FI",
"Location": "60.494915, 22.090139",
"Timezone": "E. Europe Standard Time",
"UserSettings": {
"Restaurant": "<<ANY(_Per User Settings[Restaurant])>>"
},
},
"Rows": [
<<Start:SELECT(Ingredients[ID],AND([RestaurantID]=ANY(_Per User Settings[Restaurant]),[RecipeID]=MID([_THISROW].[ID],1,LEN([_THISROW].[ID])-2)))>>
{
"ID": "<<LEFT([RestaurantID].[Restaurant],3)&"_"&UNIQUEID()>>",
"RestaurantID": "<<ANY(_Per User Settings[Restaurant])>>",
"RecipeID": "<<[_THISROW].[ID]>>",
"MaterialID": "<<[MaterialID]>>",
"Quantity": "<<[Quantity]>>",
"Unit": "<<[Unit]>>",
"Notes": "<<[Notes]>>",
}
<<End>>
]
}

View solution in original post

11 REPLIES 11

Hi, I would use a bot for this:

First - create a slice on tblemployees where employee birth month = current month. This would be the same list as you have on your schedule form.

Then create a bot on tblschedule, when a new record is added trigger an action: for each line in your tblemployees_slice add a row to tblempscheds

You might be able to reuse the actions you already set up or you can create new ones on your relevant tables. 

Hope it makes sense! 

Hi @Metworks_IT1, this is using bots, am I correct?

However, it would remove the ability of the user to select the birth month they want to trigger.

If you have a Core subscription, one way and simple way is to do this with Bot/webhook as you can use Start: & End expression with it. That will create a loop automatically.

Hi Aleksi, isn't start and end expression is used inside the email? 

My original goal is to have the employees on the list be the child items.

You can use Start: & End together with SELECT() when adding rows with the webhook. It looks something like this (from an existing Bot). Yours will be more simple..

{
"Action": "Add",
"Properties": {
"Locale": "fi-FI",
"Location": "60.494915, 22.090139",
"Timezone": "E. Europe Standard Time",
"UserSettings": {
"Restaurant": "<<ANY(_Per User Settings[Restaurant])>>"
},
},
"Rows": [
<<Start:SELECT(Ingredients[ID],AND([RestaurantID]=ANY(_Per User Settings[Restaurant]),[RecipeID]=MID([_THISROW].[ID],1,LEN([_THISROW].[ID])-2)))>>
{
"ID": "<<LEFT([RestaurantID].[Restaurant],3)&"_"&UNIQUEID()>>",
"RestaurantID": "<<ANY(_Per User Settings[Restaurant])>>",
"RecipeID": "<<[_THISROW].[ID]>>",
"MaterialID": "<<[MaterialID]>>",
"Quantity": "<<[Quantity]>>",
"Unit": "<<[Unit]>>",
"Notes": "<<[Notes]>>",
}
<<End>>
]
}

I'm not that familiar with webhooks. But I'll give it a try, will this work as well if your data source comes from postgreSQL?

 

It still works as the process is happening inside of AppSheet.


@AleksiAlkio wrote:

If you have a Core subscription, one way and simple way is to do this with Bot/webhook as you can use Start: & End expression with it. That will create a loop automatically.


Excuse me.
I have a question about the preamble.

I think you need to activate the Appsheet API for this case,
I am aware that according to the following, you need Enterprise plans to use the Appseet API, but is the Appsheet API also available for Core plans?

 https://support.google.com/appsheet/answer/10105398?hl=en&sjid=1470750638266433511-AP 

 

Webhooks work with the Core. Check appsheet.com/pricing

Understood.
Thank you for your answer!

You're welcome!

Top Labels in this Space