How to Edit a Row in another table (+/- from EnumList), from an Action in another table

Hi there. I have searched for this and found some references to using the INPUT() function, but in my AppSheet, version while I can find the action needed, there is no option to specify "with inputs" - it looks like this behaviour might have changed since the articles were written. Before I start trying work out if this is a workflow item, I thought I best check here what the right approach was.

I have two tables, one contains a list of sales opportunities, the other a list of users and their profile data. I cannot add columns to the sales opportunities table - it is read-only by design. I want to allow users to mark individual sales opportunity records as a "favourite", by adding the Opportunity ID to their profile, under the [Favourite Opps] column. 

Functionally, this is working as planned - users can go to their profile and add/edit entries to the EnumList that holds the IDs for the opps. I have a view & slice that shows all favourites and that side of things is all good. 

What I want though, is a pair of actions (Add & Remove Favourite) for the rows on the Opportunities table, that adds/removes the ID from the [Favourite Opps] EnumList. 

I can't work out what combination of Action types I need to do this, I don't want any box to pop up, I just want to see the "+" action if it's not in the list, and the "-" option if it is - this will provide all the UI feedback to the user.

Can anyone point me in the right direction please?

Thanks ๐Ÿ™‚ 

Solved Solved
0 2 261
1 ACCEPTED SOLUTION

INPUT() with a reference action is indeed a correct path to achieve that.

In order for the "with these inputs" to appear, you need to create the "set some columns" action with the INPUT() expression, then save the editor first.

In order to add or subtract to an EnumList, you would need additional columns in the user table to first receive the INPUT() value. Then you can set your enumlist via [enumlist] +/- [new column]. Or rather... IF( IN( [newCol] , [enumlist ) , [enumlist] - LIST([newcol]) , [enumlist] + list([newcol] ) )

View solution in original post

2 REPLIES 2

INPUT() with a reference action is indeed a correct path to achieve that.

In order for the "with these inputs" to appear, you need to create the "set some columns" action with the INPUT() expression, then save the editor first.

In order to add or subtract to an EnumList, you would need additional columns in the user table to first receive the INPUT() value. Then you can set your enumlist via [enumlist] +/- [new column]. Or rather... IF( IN( [newCol] , [enumlist ) , [enumlist] - LIST([newcol]) , [enumlist] + list([newcol] ) )

Thanks Marc, and apologies for the long delay in responding here. I thought I'd just reply to say that I was pleased to hear it was possible, and I did something similar to what you have suggested above. I made use of the AppSheet Database Preview to create a temporary table to hold the "change requests", then used a bot to monitor this table for new requests. Branching logic in the bot decides if this is a "follow" or "unfollow" action, and runs the correct action, using the input option in the bot workflow. Once the bot is complete, it deletes the row from the requests table.

It's a bit of a slow process, taking around 5-10s to complete, but, alongside some display-if logic to hide the invalid option (e.g. following an already-followed record, etc) I have the thing working as I'd like. Thanks for the pointers, much appreciated!

Top Labels in this Space