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,563
22 REPLIES 22

Steve
Platinum 4
Platinum 4

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?

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?

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().

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.

Ahh, I didnโ€™t notice that, thank you Kirk!

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