Add multiple rows into a another table

Romagi
New Member

Hi there ! I am starting using Appsheet and i get stuck while trying to create an action that adds multiple rows at once. Let me detailed my issue :
I have a Table A where I have a [start date] and an [end date] that gives me a [duration] in number (eg : 7 days)
I have a Table B where I list events with a [date] column
Note that Table A and Table B are linked with a [Patient] column

What I am trying to achieve is the following: When a user submit a form for Table A with n as a duration, I want to add n rows in the Table B with the date column incrementing itself adding +1 to the day of the [date] column until [End Date] from Table A is reached.

I am obviously open to changes in my data structure to make it work . I Have been searching for a while and couldnโ€™t manage to do itโ€ฆ
I hope I made myself clear as I am a non native english speaker.

Thanks you for your help.

Solved Solved
1 22 9,191
1 ACCEPTED SOLUTION

Workflows can be used to loop for n number of days, when you have a table with all the possible dates (Table C). After user enters a start & end date - use a webhook workflow to run the Add action in Table B by selecting the dates in range from Table C.

  1. Create a workflow for when a new row is added to Table A
  2. Go to Manage > Integrations & Enable โ€˜IN:from cloud services to your appโ€™ - Make not of the App ID - this needs to be chosen in the next step
  3. Add a new Workflow for โ€˜ADDS_ONLYโ€™ for Table A. Create a โ€˜Webhookโ€™ workflow action, with preset โ€˜Appsheet: Actionโ€™
    Body can be like this
{
  "Action": "Add",
  "Rows": [
<<Start:SELECT(Table C[Date],AND([Date] > [Start date], [Date] < [End date]))>>
    {
      "ID": "<<UNIQUEID()>>",
      "Date": "<<[Date]>>"
},
<<End>>
  ]
}

View solution in original post

22 REPLIES 22
Top Labels in this Space