New INPUT() function --- binding dynamic inputs to a data change action

SUMMARY:
We now have an INPUT(, ) function that can be used to define inputs that are dynamically โ€œboundโ€ to values via user input or via other actions that compose them.

This is a beta feature but available for anyone to try. If you run into issues please let us know. As always, we would love your feedback and suggestions.

This addresses two popular feature requests:

This only works today for limited scenarios involving the SetColumnValue action being invoked from a Ref Action. Thereโ€™s more coming that extends this mechanism to Add Row actions and to automation tasks.

DETAIL:
Much of the basic AppSheet app interface uses โ€œCRUDโ€ operations โ€” in particular, add/update operations on row data driven by the column structure of the tables. We automatically generate interfaces (UI or data change actions) for these CRUD operations based on the schema. Using these interfaces, end-users or application logic can โ€œinvokeโ€ CRUD operations and pass in the appropriate โ€œinputsโ€ to configure them.

However, more advanced AppSheet interfaces use Actions (in UI and automation) and Tasks and Processes (in automation). Actions, Tasks, and Processes are logical operations rather than physical operations. We currently use expressions to configure the behavior of these logical operations. But so far, we had no mechanisms to pass dynamic โ€œinputsโ€ into them. It is important to do so as AppSheet apps have a compositional model โ€” individual elements can be composed into more complex elements. In the case of actions, individual actions can be composed into complex actions. Inputs for actions are a mechanism to โ€œparametrizeโ€ the logic so that the same action can behave differently depending on how it is composed.

See Dynamic inputs for data change actions | AppSheet Help Center for detailed description

40 117 14.2K
117 REPLIES 117

This is fantastic!
Thanks @praveen

It doesnโ€™t support DATETIME field Type?

Hi there!
Thanks for the new function. It is really gonna be amazing.
Iโ€™m having a problem with it right now
I call the function via an action so the user has to enter a simple text to change a field in the form. The pop-up appears with the options (the field type is โ€œenumโ€), the selected text appears in the form when selected but when the โ€œsave buttonโ€ is pressed nothing happens and the pop-up window stays there. Just when the โ€œcancel buttonโ€ is pressed the pop-up window disappears but the changes donโ€™t apply.
I suppose itโ€™s a bug while it gets full implemented so I hope this helps because itโ€™s a great function. If is not a bug, please tell me so I can make the corrections

ฤรดi khi tรดi cลฉng bแป‹ lแป—i nhฦฐ vแบญy.

Same problem here, the changes occur but save doesnt work, so only option is to cancel.

This is working well for me. As a part of my own process of learning by doing, I made a sample app and put it in a tip:

Personally, I was interested in this new INPUT() function and made the sample app because I wanted to use INPUT() to reduce the impact of virtual columns on the performance of an app of mine. Hereโ€™s the idea:

Iโ€™m working on a dictionary app with a database of over 8,000 basic English words. One important function of the app is to prepare links to a moderately large number of online dictionaries.

The โ€œold wayโ€ I did this was to have a โ€œView B,โ€ built from the same table of 8,000 words, that needed lots of virtual columns of text on to which to โ€œhangโ€ the inline actions that link to external web sites. With over 25 such virtual columns, that meant holding more than 200,000 cells in the appโ€™s memory. That was OK on my iPhone but not on my less powerful Android device.

So, my โ€œnew wayโ€ is to use the input() function to copy the data for which the links are required (see my tip if youโ€™re not sure how to do this). This is sort of a โ€œjust in timeโ€ approach. Instead of storing 8,000 versions of everything so that they will be ready if needed, I just have the app make the required data when the user taps on a group action to navigate to the view holding the links. I still need the same number of virtual columns but 25 columns times 1 row is a lot less than 25 times 8,000.

Iโ€™m happy to report that the app now works quite nicely on my weaker Android device. And, in my case, the UX of the app is exactly the same as that of the โ€œold wayโ€ version โ€“ all of the changes were โ€œunder the hood,โ€ so to speak, so I didnโ€™t have to sacrifice anything in terms of interface design.

Perhaps others whose apps are weighted down by virtual columns can employ a similar strategy to lighten them up.

Hello there.
And if I want to provide a list of options to the user ?
Ex:
I have, lets say, 3 customers to which I can sell parts and at the moment of marking a part as SOLD I want to ask to whom its sold.
Can the INPUT be used combined with a drop down list or something like that?

The INPUT dialog will follow the same rules as whatever you set for the column in general, just like in a Form. So to have a dropdown list, youโ€™d setup the column as an Enum, or with a List-returning Valid_if. It shouldnโ€™t have anything to do with the INPUT() expression itself.

Or Suggested Values

Ravshan_0-1676031718850.png

I used it, working without problem

Ravshan_1-1676032388128.png

 

Hi,

It works with datetime field, but the placement of the pop-up should be in center rather than upper right corner. Also, for datetime, it does not show complete field and some portion of right is not visible. Even calendar icon is not visible.

Please make required changes.

the placement of the pop-up should be in center rather than upper right corner

Maybe on phones have it centered, but for Tablet or Browser, I like the pop-up being in the top right.
Users can quickly edit a couple of columns with an inline action while referencing the related rows in the table. Very useful.

@praveen When you copy an Action โ€œData: execute an action on a set of rowsโ€ and change the Referenced Table, you will get this Error message:

Workaround:

  1. Copy the Action
  2. Delete the โ€œWith these inputsโ€
  3. Change the Referenced Table
  4. Set the โ€œWith these inputsโ€

.
.
For those who get stuck on this error and find themselves unable to delete the action, you can switch from grid to list view in the actions editor:

.
.
And then youโ€™ll be able to delete the action before it can throw this error:

.
.
Keep in mind that you might have to do a full refresh of the page to even have the opportunity to delete the action after this shows up.

Ugh, thanks for reporting. Weโ€™ll get this fixed.

Great feature! Thanks!
Useful for eg. sending reports as email (pop-up to fill in email addresses that also triggers a BOT).
And updating tasks and reports with new status (not having to make separate actions leading to specific update-views or quick edit). Much better UX with INPUT().

I havenโ€™t figured out how to get initial values in the INPUT().
The โ€œdefaultValueExpressionโ€ part of INPUT() doesenโ€™t really do that in my testing. (I cannot make that do anything)
Anyone knows how to get the wanted initial value in INPUT()?

Yes. Please look at my tip:

Thereโ€™s are instructions there and a sample app you can play around with.

I got an error, I canโ€™t press save.
Is there any solution?,help me!
Thanks!

I assume you are posting here because this has something to do with the new INPUT() function. If so, could you provide more detail? I wonder if INPUT() and direct editing are interfering with each other in some way.

ฤรขy lร  hร nh ฤ‘แป™ng cแปงa tรดi vแป›i hร m input()

Your INPUT() formulas are empty. I think the second half can be empty but that you need to have something in the first half. Perhaps something like this:

INPUT("DUYET","")

Please see my tip for a sample app that works. You can try playing around with expression in my sample. That might help you fix the problem.

Thanks!
Tรดi cลฉng cรณ mแป™t แปฉng dแปฅng khรกc sแปญ dแปฅng input("","") nhฦฐng chรบng hoแบกt ฤ‘แป™ng bรฌnh thฦฐแปng!

Google translate: โ€œI also have another app that uses input(โ€","") but they work fine!!"

Interesting. I think, though, that the first half is a name of the function. In your example you are trying to use it in two different columns. If they are different values I think you need to have different names in the input expression.

Syntax

INPUT( inputName, defaultValueExpression )
Arguments

inputName (Text): Any input name that is unique within the context where it is used.
defaultValueExpression (any type): the default value that should be associated with this expression.

Cแบฃm ฦกn bแบกn nhiแปu!
Tรดi ฤ‘รฃ thแปญ nhฦฐ bแบกn nรณi nhฦฐng vแบซn khรดng lฦฐu ฤ‘ฦฐแปฃc.
Tรดi ฤ‘รฃ gแปญi email nhแป hแป— trแปฃ tแปซ Appsheets nhฦฐng chฦฐa cรณ kแบฟt quแบฃ.

โ€œThank you so much!
I tried as you said but still canโ€™t save.
I have emailed support from AppSheet to no avail.โ€

Hmmmm. support@appsheet.com is usually very good. I wonder what the problem is.

Does INPUT() only work with text or number field types? I am trying to use it with a Ref field type, but so far no luck.

Works with REF as well. Works fine hereโ€ฆ

Tรดi ฤ‘รฃ thแปญ nhiแป‡m thรฌ phรกt hiแป‡n nhฦฐ sau:

1,Cรกc bแบฃng khรกc sแปญ dแปฅng chแปฉc nฤƒng input() hoร n toร n bรฌnh thฦฐแปng.

2,Khi tรดi xรณa cรกc cแป™t cแปงa bแบฃng dแปฏ liแป‡u xuแป‘ng tแปซ 65 cแป™t xuแป‘ng 12 cแป™t thรฌ chแปฉc nฤƒng input() ฤ‘รฃ hoแบกt ฤ‘แป™ng?

Tรดi khรดng hiแปƒu,mong mแปi ngฦฐแปi sแบฝ tรฌm ra lแป—i sแป›m giรบp tรดi.

Cแบฃm ฦกn!

How to reset a column value when using INPUT()?
Iโ€™m in a detail view and created an action to change the value of a column. The input form pops up and I can change the value. But I want the column to be blank.
I tried โ€œReset on Editโ€ with CONTEXT(โ€œViewโ€)=โ€œMy_Detail_Viewโ€). I even enabled โ€œReset on editโ€ without an expression. But this will not reset the column in an INPUT() window.

Reset the value would be very useful if you have 2 or more columns with Dependent Dropdown: Changing the first column should blank the next column.

@praveen Could we get an own CONTEXT() for Input()? Like CONTEXT("ViewType"="Input").

If the Form View is with Page Style โ€œTabsโ€, then also the Input View will have multiple pages.
3X_b_d_bde79832771755cacdba654ce5b088dd9adc8da9.png
Even when you have just one column to edit with INPUT().

@praveen I have a question about your example in the help article.
In the Action โ€œSetQuantityโ€ I would like to add another column with INPUT(). For example โ€œColorโ€.
So in the LineItems Detail view I can change the Quantity and the Color via the INPUT() Action.
But in the โ€œParentโ€ Action I donโ€™t like to involve this Color column.
It should change the Quantity, but should leave the Color as it is.
How can we do that?
I tried different Versions of IF() and IFS() and CONTEXT().

Hi Fabian, so you want to bind one input but not the other? For the Color column, you want to tell it to โ€œjust use the defaultโ€? Hmm. On the backend, it works this way because there is no user to ask. But on the front-end, if there is an INPUT that isnโ€™t bound, then we assume you intend to ask the user.

Hi @praveen yes thatโ€™s exactly what I want to do.
If CONTEXT() would work for INPUT() then I could do it. I would say โ€œshow the Color column only when Iโ€™m in the LineItem view, but not when Iโ€™m in the parent viewโ€.

I would be able to delete like 6 extra tables and forms an app with this.

Hello, I try to do INPUT Box
but the result is in this picture below
whatโ€™s wrong with it please tell me how to improve that ^^

Thank you

I found today that you cannot do this:

In other words, you canโ€™t build an expression where the output of INPUT() is used in any way besides directly writing into a column. In this use-case, you cannot add the entered value to the current value.

Iโ€™m hoping that this functionality will be available in the future.

Sadness

Why canโ€™t INPUT() simply work as an expression in Action: Add a new row in another table using values from this row?

In the example of @Rifadm817 , the workaround is to add that row first, then execute an action that sets the column of the newly added row using an Input.

That means you will need to create 4 actions:

  1. Group Action
  2. Action 1.1: Insert new row to another table
  3. Action 1.2: execute action on set of rows (using Action 1.3)
  4. Action 1.3: set value of some columns in this row - this is where you put the INPUT().

All these unnecessary actions will be eliminated if Input simply works in Action 1.1.
Also not ideal, as if the user clicks โ€œCancelโ€ in the Input Form pop-up, the first action of adding the new rows has already finished although the user thought he canceled the entire action.

@praveen Any particular reason why we canโ€™t we pop up the Input() before adding the new row?
Why do we have to add the row first, then open that row, and update the values using the Input()?

I have encountered the following:

I have a Annual Report table with up to 12 child items stored in the Water Use table.

Both tables have a reference field to the Meter Information table.

I have an automation task that if the MeterInformation ref in the Annual Report table changes, then this task also changes the MeterInformation ref in the Water Use table.

I have introduced an action to the Annual Report table of type change a value with the INPUT function so that I could ideally change the MeterInformation ref for multiple Annual Reports and thereby concurrently change the MeterInformation ref on the related Water Use records.

The first report I executed this action on went flawless, however the next successive tries when I click the save button on the INPUT dialog nothing appears to happen. The dialog unfortunately stays open and I cannot tell if the application is attempting to sync but is running into any problems. There also is nothing in the Audit Log indicating that the change occurred in the Annual Report table and then initiating the change automation.

Any help would be appreciated.