Jul 27, 2021 05:07 PM
I’ve got a script that chunks through API requests out to a 3rd party, and instead of outputting a ton of status text, I thought it would be a great UX if they could see the progress of those requests and be able to stop them early, all in the same button.
Is this possible to update an input button’s label after it has been sent to the UI?
If that isn’t possible, is it possible to update an output string similarly?
I’ve tried a few things that might have worked normally outside of airtable, but haven’t had much luck as most of these communication objects don’t return themselves to be overridden later.
Would be happy to hear any weird ways this can be accomplished as well (another table in the base that contains the value, etc).
It doesn’t have to be elegant, just has to be update-able haha
Jul 27, 2021 07:44 PM
Welcome to the Airtable community!
Airtable scripts have very limited input/output capabilities. It was actually inspired by command line interfaces. Thus, you cannot change anything previously output by the script (except for clearing the screen).
One possibility is for your script to continuously clear the the screen (
output.clear()) and put your new step /100 text on the screen. This technique was used by old command line interfaces as well.
You also cannot change the label of a button field–it is set in the field’s configuration and must be the same for all rows.
Finally, if you want a lot of control over your input/output, look into creating a custom app. Custom apps are a lot more work that scripts, but also are capable of doing a lot more.
Aug 03, 2021 03:50 PM
Thanks @kuovonne, very helpful. Figured I’d share what I built :slightly_smiling_face:
Now that I understand the inspiration, clearing output makes a ton of sense and I whipped up a pretty sharp UI to provide our staff with investigation capabilities by ingesting algolia API endpoints (ALSO working around Algolia’s analytics API shortcomings we did not instrument properly to deal with).
Essentially, we pull 1,000 top searches, and then roll through each search looking for a specific influencer’s individual search counts for those terms. It’s not perfect, but it’s saving their bacon while the product team reacts to the need (yay airtable!)
There’s a lot of unimportant domain knowledge here being shown, but this script successfully uses most of the scripting capabilities from airtable including:
The below gif shows a fast, shallow depth against the top 10 search results for a specific shop:
Edit: source for the unicode progress bars I stole from to create the old school command line progress bar, to really embrace your inspiration haha: Unicode progress bars
Aug 03, 2021 05:30 PM
Thank you for coming back and sharing your creation, especially the animated gif. It really show off the capabilities well.
Aug 04, 2021 10:04 AM
Any style points scored in the Sripting app are hard-earned, this looks great.