Hack to make versatile ref-like actions

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:

2X_b_b9474459daa49b2c052e918c533ed2dc08c608ab.png

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:

2X_3_37f99190b0e5cb8142a4bae0cac1a37a893311fe.png

“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!

2X_9_9dfb5505f9a4e20bbeeb495cd648ca78e1d67d9e.png

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:

  1. Make a ref the old-fashioned way.
  2. 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.
  3. 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.
  4. 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.

2X_2_241d5ea2b38fa59261f90d601f1cb31f15dae2b6.png

That’s it! I hope you have found something in this post that you can use.

11 22 3,551
22 REPLIES 22

Steve
Participant V

This also how the compose email button is attached to Email columns, and how compose SMS and start call buttons are attached to Phone columns, among others.

Thanks! I haven’t worked with those functions. I take it, though, that they are similarly “hackable.”

Nice article Kirk.
In this way you can also add inline Actions in a table like “delete”.
2X_1_1d082796c9f2887a01b57924caa37c670b15bdc7.png

Or these little angles to change the order in a table:
2X_4_44cedafc7cb76c4618aa1f621c314cb612d903a4.png
Just create a Virtual Column of type “Text” with the expression:
""
and attach the Action to this virtual column.
You can even attach many Actions to one virtual column.

Thanks @Fabian! Perhaps you know about a method that I’m still unaware of. When you say

how is that done? Is that done in the way I indicated or is there another way to do that?

It’s as you said. “Display Inline” and “Attach to column” then choose the Virtual Column.

Wow! This is embarrassing. I thought I had found something new but now I realize that I had never understood the “Display inline” option to begin with. Now I see that it does exactly what I thought my “hack” would do. Well, at least I know now. Thanks for telling me. I think I’ll write a note to indicate that my post is based on a misunderstanding. Thanks for your helpful response.

I found it very useful and learnt a lot from your post.

Thanks @Riki_Armstrong! This has been a real learning experience for me. Today, I realized that there is an important difference between ref columns and columns linked to inline actions. I rewrote the “Postscript” I placed at the top of my post to describe that difference. Since ref columns can do things that inline actions can’t, now I think that this may be a useful “hack” after all.

You can attach the inline actions to a normal column as well.2X_6_65d9d9a37bd2b960c080b698c793630d8f40708c.jpeg

Fabian, I found this very helpful topic when searching a way to order child items within a parent record.
(In my case I have to add products to a package and keep track of the order they are manufactured within this package.)

Those little angles in your example make a very nice UI for this purpose, but I was a little confused what column value or method you are using for sorting the rows?

BTW, does clicking some of the column headers mix up the order or can this be avoided?

nimble777
Participant V

Fabian, what does the OPEN() expression do?

Sorry @nimble777 - what do you mean by OPEN() expression? Where did you find that? Could you please post a screenshot?

nimble777
Participant V

OPEN is a table name in that expression.

Ah! So there are instances where someone would want to reference a table instead of just a column…

If you were to write MIN([Priority]), that would only work when you were in a table that has a column called “Priority.” If you have a table called “OPEN” that has a column called “Priority”, MIN(OPEN[Priority]) will allow you to call up the lowest value in that column when you are in another table. So, it depends on the context in when the expression is used. See @Steve’s explanation here:

MIN(Products[Price]) : The lowest of all values in the Price column of the Products table. Equivalent to MIN(SELECT(Products[Price], TRUE)). See also SELECT().

nimble777
Participant V

Hey all, I am attempting to prioritize my Task Center table, and either the icon for the action does not come up, (even when the task is incomplete) or the action is not allowable to be used more than once and then the icons disappear.

Can anyone help?
The expression that I am using for the show if/behavior part is:
and([Completed?] = “FALSE”,[Priority]<>MIN(Task Center[Priority])) …I copied it from the app. What am I missing?


Thank you in advance.

Wesley W.

Are you working with a slice? If so, the action needs to be in the slice. If that’s the problem, just adding it to the slice might be enough to fix the issue.

nimble777
Participant V

Ahh, I didn’t notice that, thank you Kirk!

nimble777
Participant V

Ok, so the action icons are showing up when I remove this expression:

[Priority]<>MAX(OPEN[Priority]))

…but the icons are not firing the action.

When I replace this part of the expression the icons disappear.

Hi @nimble777

Did you test this part of the expression ?

Top Labels in this Space