Using INPUT() to update another table using a value from this row

This “Tip” is a little report, with a sample app, on my own attempt to familiarize myself with the new INPUT() function. As @praveen has indicated, the advent of this function gives us the power of an “UPDATE EXISTING ROW(s) using values from this row” action:

Here’s a sample app I made to test this out:

https://www.appsheet.com/samples?appGuidString=502cc394-2717-4a69-8246-5fc26a1aa9cf

This extremely simple app has two tables: one with multiple records and one with only one record. The input function allowed me to make an action that takes a value (a word, in this case) from the record I happened to be viewing on the bigger table and then write it to the designated spot on the smaller table.

Here’s how I put it together.

  1. On the single record table I made the following action:

The expression is as follows:

Screen Shot 2021-07-16 at 13.23.12

In this case “Word_input” is just what I decided to call this function. You can make up just about any function name you want, I think. I set “AppSheet” as the default but in my application the default is just a placeholder because my app doesn’t use it; it always takes the value from the other table. So, I think the default value could be just about anything and it wouldn’t make an important difference in my app.

Before we go on, let’s take a look at how this action functions in isolation. In the app, I’ve set the action to display prominently with the label “WRITE WORD”:

I’ll hide this writing action when I actually use INPUT() in a working app of mine but I made it visible in the sample. If you tap on it inside the “Single word” menu, this happens:

Since the action hasn’t received a value for “Word_input”, it asks the user to provide it. The next step provides that value so the app doesn’t need to ask for it.

  1. On the big table, I made the following action:

Since “word_input” was part of the referenced action, I was able to select it and define it with a column name.

That’s it!! Works just fine!

input.2021-07-16 13_52_54

10 Likes

Great job, thanks for sharing this sample app !

3 Likes

Yes, good to see the new INPUT() function explained through an app. and your associated description/. Thank you @Kirk_Masden

4 Likes

@Kirk_Masden what a beautiful simple explanation. Way better than my complex wordy description. Thank you.

@Arthur_Rallu FYI

7 Likes

Thanks so much for your kind words, @praveen ! I think you have many different usages of this great new function in mind. I was only thinking about what I want to do in my own app, so I wasn’t burdened by the need to make a comprehensive explanation. :slight_smile:

By the way, you helped me with a problem I have been struggling with regarding how to improve the performance of an app that has lots of inline actions that link to URLs. I’m using INPUT() to deal with that problem. This way, even if I have a huge number of words to look up on one table I can simply make the app rewrite the word that the user wants to look up onto a tiny sheet (just a few records). Then, since the sheet is tiny, it can have dozens of virtual columns without getting too heavy – at least that’s my idea. I hope I’m on the right track. :thinking:

4 Likes

Thanks @Kirk_Masden
I might give this a test run . I have found lately that all the new “complex wordy descriptions” just make my head spin. Maybe Im getting too old for the new Appsheet. :slightly_smiling_face:

5 Likes

Thanks for the encouragement, @Lynn ! I had trouble understanding things at first and that led me to try to put a sample app together before attempting to use the function in one of my main apps.

4 Likes

@Kirk_Masden
I find that is a good way to learn also.

4 Likes

Great example here @Kirk_Masden . I just used it to build the same functionality.

One thing to note is that the “With these inputs” section on the “execute an action on a set of rows” Action might not show up right away. I had to set up the ref’d Action, with the INPUT() first, and then save the editor before it showed up.

3 Likes