Single category headers in workflow templates for multiple records of same category

Say you have data like this:
2X_7_7c2f4b9ce065dd98e98071813f4be997caa37fbd.png

With “Group by” selection in a Table view, you can easily display this in the app like so:
2X_a_a10cf8d9202d32837c0d72ffb262e23f55f16bb1.png

But what if you want to do so in a PDF file generated via a START expression in a workflow?
Use the following general model:
2X_3_3a5d3c8282fba61adf1dae4d3ed814d183724c63.png
Which basically says “if this is the first item in this category, display a header”.

The tricky part is when using a subset of values in a table, like child values of the parent record you’re working with. Then for the second blue section, you’ll need to FILTER the whole table by a ref column, which requires the use of a _THISROW statement, and they work kind of funky inside START expressions in workflows. You’ll probably need to use _THISROW-1. Don’t really want to get into that here, but just didn’t feel like this Tip was complete without mentioning the issue.

16 12 3,554
12 REPLIES 12

Steve
Participant V

Outer <<Start>> tag:

<<Start: ORDERBY(FILTER("table", ([_ROWNUMBER] = MIN(SELECT(table[_ROWNUMBER], ([_THISROW-1].[category] = [category]))))), [category])>>

Inner <<Start>> tag:

<<Start: FILTER("table", ([_THISROW-1].[category] = [category]))>>

I have been using AppSheet for almost 3 years. I have read your expression like 12 times and still don´t understand it. I just can say you are a god. I was trying to make a grouped catalogue and it has being impossible until I arrived at your answer. Thank you for this.

SteveSteve Coile
The solution given is very useful ,

Can we have the workflow template for the Report (file attached) for the data(file attached)!
i hv used
<<Start: ORDERBY(FILTER(“SLICE_D”, ([_ROWNUMBER] = MIN(SELECT(SLICE_D [_ROWNUMBER], ([_THISROW-1].[NAME] = [NAME])))))+FILTER("SLICE_C ", ([_ROWNUMBER] = MIN(SELECT(SLICE_C [_ROWNUMBER], ([_THISROW-1].[ ACCNT] = [ACCNT]))))), [NAME])>>

<<[ NAME]>>
for the header
and
<<Start: FILTER(SLICE_D, [NAME]=[_THISROW-1].[ NAME])+FILTER(SLICE_C, [ACCNT]=[_THISROW-1].[ NAME])>><<[UNIQUEID]>>
DATE<<[DATE]>>
PRT<<[PRT]>>
NAME_D <<IF(IN([_THISROW-1].[UNIQUEID],SELECT(SLICE_D[UNIQUEID],[ NAME]=[_THISROW-1].[ NAME]))=TRUE,[UNIQUEID].[ NAME_D
],””)>>
ACCNT_C <>

<>
file link copied

https://docs.google.com/spreadsheets/d/1UXA-zlVrFN0l1lhJuaOsj7Nywth44T5JXdXC8A45nFc/edit?usp=sharing
Name_Report|400x387 3X_f_d_fd5a24c62d4b3536d8bb5a49be0337170c0d201f.png

3X_3_2_3293f2684bc4585bd60583f72a14940772cabc88.png

SkrOYC
Participant V

@Guillermo wrote:

still don´t understand it


Maybe this helps:

Solved: Re: PAGE BREAKS IN PDFS - Google Cloud Community


@SkrOYC wrote:

You take any row from the current table that just serves the purpose to make Start: add n number of rows used as categories, basically if you use MINROW or MAXROW doesn't matter, because we need exactly one from all of the categories you need. This can be the [Project name] column in your case. Then you add another Start: to just return the rows that has the same [Project name] as the row taken from the outer Start:

You can do this a lot of times to keep nesting, just don't forget that each time you go to another nested Start: you need to query [_THISROW-N].[Category] where N is how deep the Start: is related to the first one.


TeeSee1
Participant V

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/I-would-like-to-have-the-pdf-look-better/td-p/6...

Very similar to what Steve had described with a slight variation in the outer START expression.

Mine expects a separate Categories table.

For what its worth...

I took my explanation from Steves invention, but trying to be as clear as water

Former Community Member
Not applicable

Sorry for replying to this old post, but I'm actually need to do this group by and the code is not working so I need to understand what's happening in here.

The screenshot has a table with 2 columns, category and value, however, the code seems to be using 3, category, value and key, is this table[key] supposed to be my own table and the key/ID column?
I actually tried that but it's not working, I even use literally table[key] and nothing. Do I need to apply  filter to the first orderby?

Any guidance or explanation will be appreciated since using the code as it is is not working, maybe I'm missing something.

I'm sorry Ragnaros but it seems that your knowledge of the platform is kinda weak. I suggest to read the docs from the basics so that you get a better idea before going into such an advance topic as this is

AppSheet Help

Former Community Member
Not applicable

wow didn't even bother to try an actually help, but hey at least your post count grew up you're hero of the community now. Thanks

I'm really sorry that you found this ofensive. Maybe because english is not my main language I give it another meaning.

The way I started with AppSheet was by reading the docs, didn't even bothered to ask for help until I knew the basics and a litle bit more, so I though that it would be helpful for you as it was for me to try read the docs first.

I gave a detailed explanation about the behaviour of headers in workflow templates in the post I mentioned above:

Solved: Re: PAGE BREAKS IN PDFS - Google Cloud Community

@SkrOYC I wanted to thank you for all your years of input into this community, especially taking the time to read, advise as well as translate  many topics that have driven this platform forward with invaluable information.

I also salute you for humbly apologizing when small word discrepencies may translate wrong in eyes of readers although not even intended, there is not one ounce of offence in you from all your assistance and posts I have seen over the years.

Please do continue with your humble nature my good friend... 

 

Top Labels in this Space