Sample App : Child table with multiple parents. Show different inline views for each parent

Here is a common scenario, where you may have 2 main data tables, then a single “join” table that is a child of both. In the attached sample app, you see the scenario of product and order, with the join table being line_item. In the join table, there is a reference to a product record, as well as an order record, amongst other data such as quantity.

Here is the backend data

image

image

image

The Detail views for both parent tables will show an inline view of “Related line_items”. However there is no “natural” way to show a different inline view depending on which parent table the user is in. Consider that from product, you’d want to see [order] and [qty] columns, but from order, you’d want to see [product] and [qty] columns.

The way to accomplish this is to start by creating a new slice for line_item table.

Just a basic slice, include all columns, include same permissions, do not include a row filter condition.

Next, in one of the parent tables (I chose product), create a new Virtual Column. You’ll copy the REF_ROWS() expression from the existing “Related…” VC, and simply change the table name to the name of the new slice.
REF_ROWS("new slice name" , "ref-column" )
image

Hide the original "Related..." VC, and show the new one.

Create your own inline view for this new slice, however you'd like.


Now you will see different inline views, based on which parent record you are viewing from



You can find the sample app “Differing Inline Views” on my portfolio, here:
https://www.appsheet.com/portfolio/546920

10 Likes

I ran into this recently in an app. Not sure how I resolved so I’ll have to re-review and apply this tip.

What I found particularly annoying is that when you click on the View button on the Inline view to see more rows, the appearance of the key column behaved differently.

For example, if I was in a Product Detail view showing the line_item Inline table, when I click View to go to the full-screen view to see more rows, I want the Product column to show as a reminder of what Product was being looked at (yes it is needed).

In the Detail view’s Inline table, I don’t really need to see the Product because Product is being shown in the Detail view above.

HOWEVER, what I found was the Product column would show in the Detail view Inline table but would be automatically removed from the full-screen view, where it is needed the most. I believe the behavior should be reversed. I think I ended up creating a “display” column to get around the issue.

But maybe this approach will resolve that problem as well?

Hmm, it appears you are correct. I don't believe I've ever seen this before.


image

          |
          |
          V

image

I tried various show_if expressions to try and force it to show up, none worked (TRUE , CONTEXT("View") = ""…)

This reminds me of how drill-down Group Bys work, once you click one of the groupings you can’t see which group you are in anymore. I’d hazard a guess that the same mechanism is in place here for fullscreen filtered inline tables.

I’d also say this is a completely separate issue and should be posted in a separate thread. I also have a Feature Request that may fix the same issue, if it turns out to be related to groupings.

1 Like

Yup.

1 Like

Been there. Done that! Should I have mentioned it? :innocent:

1 Like