Sorting order of items in nested table

In Appsheet, I have a table of departments, which links to a table of people in those departments. 

I'm trying to create a report template that lists out the people in each department, grouped by department and sorted by last name.

I want something like:

Department 1

Adams, JoeSmith, JohnZarha, Tim
Day, SaraWright, Julie 

Department 2

Andrews, MaryRega, Tim Smith, John
Bendi, Sue  

 

I have sorted by department and then made a nested table to make the three columns.

<<Start:ORDERBY(SELECT([Related People][WID], MOD([_ROWNUMBER], 3)=1), [Last Name], TRUE)>><<[Last Name]>>, <<[First Name]>>
<<End>>
<<Start:ORDERBY(SELECT([Related People][WID], MOD([_ROWNUMBER], 3)=2), [Last Name], TRUE)>><<[Last Name]>>, <<[First Name]>>
<<End>>
<<Start:ORDERBY(SELECT([Related People][WID], MOD([_ROWNUMBER], 3)=0), [Last Name], TRUE)>><<[Last Name]>>, <<[First Name]>>
<<End>> 

This sorts by the row number of the People table, not the last name. Since the people were not added in alphabetical order I end up with something like this. 

Department 1

Smith, JohnZarha, TimAdams, Joe

Wright, Julie

 Day, Sara

Department 2

Smith, JohnAndrews, MaryRega, Tim
 Bendi, Sue 

All the people are in the right department, but not filling out the columns evenly (and therefore not sorted by last name appropriately).

Is there a way to create a virtual 'rank' column that I could use to create the table layout instead of the row number? Or any other ideas?

Ideally, the names would be sorted first vertically, then horizontally, but I would be alright with horizontally then vertically.

Any help would be appreciated!

Solved Solved
0 3 261
1 ACCEPTED SOLUTION

Steve
Platinum 5
Platinum 5

I'm thinking you'd have to use an HTML template rather than a Docs template. See also: Part 1 - Almost pixel perfect pdf reports from automation

View solution in original post

3 REPLIES 3
Top Labels in this Space