PDF BOT creates duplicate tables

Hello,

I have a bot that generates PDFs. This bot creates a report in the Report table by listing entries from the work_diary table. The Report table has the following columns: id and date. The work_diary table includes these columns: id, date, employee, and manager.

The bot runs normally, but I am unsure why it is creating duplicate tables (highlighted in red line).

Here is the pdf template:

Are there multiple records in the work diary with Adrian as the manager?

1 Like

Yes, There Are.

Is there a logical error in the formula?

Your first <> expression with the SELECT() statement you have [manager]=[manager]. One of those columns probably needs to be [_thisrow].[manager]. That’s the only hickup I see. This issue specifically occurs with SELECT() statements when using two different tables that have a common column name or when using the same column from the same table when trying to make comparisons. I could be wrong however.

Your outer loop should only have one iteration per unique manager. It looks like you have a managers table, perhaps you can iterate across that table 1st?

Markus pointed out the [manager]=[manager] portion of your 1st start expression. I don’t believe it’s causing any issues here, but it certainly isn’t helping you in any way, or even doing anything.

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Single-category-headers-in-workflow-templates-for-multiple/m-p/277292

Here replace the categories with your managers to get a unique list of them to iterate over in the outer most LOOP/START

1 Like

I am utilizing this formula based on @Steve 's guidance in the following thread https://www.googlecloudcommunity.com/gc/Tips-Tricks/Single-category-headers-in-workflow-templates-for-multiple/m-p/277293/highlight/true#M1016 and it is proving effective."

<<Start: ORDERBY(FILTER("work_diary", ([_ROWNUMBER] = MIN(SELECT(work_diary[_ROWNUMBER],AND([date]=[_thisrow].[date], ([_THISROW-1].[manager] = [manager])))))), [_employee_name])>>

1 Like