Postscript: When I began writing this, I didn’t fully understand the similarities and differences between the navigational actions that are automatically attached to ref columns and inline actions that can be manually associated with columns. Now I understand that both kinds of actions make it possible for us to create something that looks like this:
Though they can look the same, there is an important difference between ref actions and inline actions: Ref actions allow us to draw the label from data in the table being referred to. In my own experience, this can be a crucial difference if one is having trouble with a lag in update times due to syncing. In AppSheet, not all columns in all tables are recalculated simultaneously. So, a select() expression that references another table may not yield a number that is immediately up-to-date, while a label from a referenced table may. In the image above, I wanted the Session statistics column to display the correct “Cards left in D to W” number without delay. I was able to accomplish this with a ref column but not with an inline action. The “hack” I explain here can allow you to take advantage of this feature of a ref column and still get the versatility of an inline action.
By the way, if you are having trouble getting calculations to appear correctly immediately, without waiting for a sync to finish, you may also be interested in this tip of mine:
User generated actions are cool. They greatly expand the range of app building possibilities. Now that several years have passed since AppSheet introduced user-generated actions, it’s hard to imagine how we got by without them. Unfortunately, placement within a page can still be a problem. Here are the official choices we currently have:
“Display inline” tucks the action into a spot that is accessed by tapping the upper right-hand corner of the screen. [Postscript: This is not entirely correct. “Display inline” can attach to a text of line. I didn’t understand this usage when I wrote this.] It can help one avoid clutter but has various drawbacks. “Display overlay” and “Display prominently” are useful but too many such actions make a cluttered screen.
Ah, if only we had cute little actions that could be placed at the end of a line of text – like a ref!
Well, as Glinda the Good Witch said to Dorothy in the Wizard of Oz, “you’ve always had the power, my dear, you just had to learn it for yourself.” Our “ruby slippers” are system-generated ref actions. Here’s how to utilize them:
- Make a ref the old-fashioned way.
- Go to “Behavior” in the app and copy the system generated ref action that is a “Go to another view within the app” action but is not editable by mere mortals.
- Now that the action has been copied it can become any kind of action you choose. I haven’t tried all of the possibilities but it seems that the entire range, including “Grouped: execute a series of actions,” is available. It’s also possible to choose a different icon.
- If one does not use a slice, we now have two actions that appear after our text (see below). This may be fine in some cases. However, if you want to control which actions appear after the text and which do not, a slice can be used to accomplish that.
That’s it! I hope you have found something in this post that you can use.