Duplicate multiple row coming from same table

Hello all,

I would like to duplicate few rows on the same table.
I use Appsheet for my budget management.
I have both table 
Expenses

Capture d'รฉcran 2023-11-04 215304.png
Budget

Capture d'รฉcran 2023-11-04 2203434.png

Budget have a Ref_ROWS to key Date on Expenses
Capture d'รฉcran 2023-11-04 2155024.png

Every month, i do my budget and a new date is created,
each time i imput Tags manually in table expenses.
If its possible i would like these Tags are duplicate and add new after the old with new key date.
I tried with both actions, but im not comfortable with this code.

Thanks for helping me

Herod

 

Solved Solved
0 5 417
1 ACCEPTED SOLUTION

What do you have set as the Key for the Expenses table?  I see above its the Date column but if that were the case then you'd have a duplicate key issue.  Did you change it?

Also, why is Date a Ref type value?

In the Duplicate Budget Rows action you need to adjust the Date for the rows being added.  Otherwise, you are adding exact duplicates and depending on how you have the key set, AppSheet will remove the duplicate row.

View solution in original post

5 REPLIES 5

 

You will need 2 actions as described below:

1)  Create an action of type "Data: add a new row to another table using values from this row".  If though it states "another table" it can actually be the same table.  NOTE: set the Prominence as "Do not display"

Screenshot 2023-11-05 at 9.03.51โ€ฏAM.png

2) Create an action of type "Data: execute an action on a set of rows" that selects the rows to be duplicated and sends to the action created in #1.  The expression in this action assumes that you are copying the rows once the actual date is in the new month.

Screenshot 2023-11-05 at 9.11.58โ€ฏAM.png

3)  How you set the Prominence of action in #2 will depend on how you want to activate the actions

I hope this helps!

Thanks for your help.

I done the process like you wrote, i guess.

Capture d'รฉcran 2023-11-05 221649.png

Capture d'รฉcran 2023-11-05 221731.png

But, when i click on the action, i see 4 adding rows, so it should be work, but
when i check on the database on google sheet, i see nothing addings
Capture d'รฉcran 2023-11-04 214046.png

Probably the issue comes to the Prominence ? what do you think about ?

Thanks again

What do you have set as the Key for the Expenses table?  I see above its the Date column but if that were the case then you'd have a duplicate key issue.  Did you change it?

Also, why is Date a Ref type value?

In the Duplicate Budget Rows action you need to adjust the Date for the rows being added.  Otherwise, you are adding exact duplicates and depending on how you have the key set, AppSheet will remove the duplicate row.

Yep it was my issue, i changed my key and i forgot [_THISROW] in my expression.

select(expenses[_ComputedKey],[_THISROW].[Date]=[Date])

Computedkey is key concatenate with [Date] and [ID]

Now its work Thanksssss !!!

Date is a Ref value to have connection between tables Budget and Expenses

Just a last question.
I tried to run this action on View Budget, because i want that trigger after addings a new [Date] on Budget.
But as both actions are referenced in table expenses, i cant triggered it.
I thought about to make a bot ?

Apologize for delayed response.  I have been extremely busy of late.


@Herod wrote:

Just a last question.
I tried to run this action on View Budget, because i want that trigger after addings a new [Date] on Budget.
But as both actions are referenced in table expenses, i cant triggered it.
I thought about to make a bot


In the action #2 I mentioned in my prior post, set the "For a record of this table" to the table from where you wish to start the copy process.  Budget in your case.  Leave the Referenced Table set to Expenses.

 

Top Labels in this Space