PDF TEMPLATE HELP - PARENT AND CHILD RECORDS

Dear friends,

I wish to print parent and child record in the PDF. This pdf has the records list of records selected by the users. Yellow colour represents child records and green colour represent parent records.

this post is next level up gradation of this 2 post.

Post 1:

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/NEED-TO-ADD-SL-NO-TO-THE-ROWS-TO-PDF-REPORT-OF-FILTERED-RESULTS/td-p/606993

Post 2:

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/NEED-TO-ADD-SL-NO-TO-THE-ROWS-TO-PDF-REPORT-OF-FILTERED-RESULTS/td-p/509151

Kindly help me with this

@AleksiAlkio @Suvrutt_Gurjar @WillowMobileSys @Rifad

1 Like

For this kind of layout, you need to use nested START expressions - One for parents and one for children. BUT because the Child table is in its own formatted table spanning several lines in the PDF and part of the parent, the START expression for the parent must be OUTSIDE of the Parent data table template. Something like the image below.

I hope this helps!

2 Likes

THANKS BRO, CAN YOU PLEASE HELP ME IN CREATING AN EXPRESSION TO GET [RELATED CHILD RECORDS].

1 Like

@AleksiAlkio and @MultiTech some where in your post I have seen [_THISROW] -1 logic**,** to pull the grand child records. can you please share the link ?

Doubt : for generating PDF , Should I pull the grand child records to the parent table ( virtual column : type : list) by using select () function like which was done usually for pulling child records or template itself knows to pull the grand child records even if the grand child records are not available in parent table?

Any reference for this case ?

2 Likes

I’ve got a video that walks through how to setup nested templates like this; there’s an app you can check out/copy to see the specifics.

Hi @MultiTech ,

please see this

Template :

Output : It leaves child records

in the column [ # ] expression used is

<<START:Select(consignment Article[Article Number],in([CONSIGNMENTS SL NO],[_thisrow-1].[PDF REPORT]))>><<#>>

Why it doesn’t pull the grand child records ? should [PDF REPORT] be printed in template to make the expression to work ? since expression has [_thisrow-1].[PDF REPORT].

Note :

key values of the [PDF REPORT] is no where printed in the template, just other columns like date, customers names are printed

PDF REPORT is a virtual column with the type : LIST in the table with the condition that pulls records from another table consignment.

1 Like

JUST TO TRY :

A COLUMN HAS BEEN ADDED TO THE PDF TEMPLATE <<[CONSIGNMENT NUMBER]>>

GRAND CHILD EXPRESSION HAS BEEN CHANGED TO

<<START:Select(consignments Articles[Article Number],in([CONSIGNMENTS SL NO],[_thisrow-1].[CONSIGNMENTS SL NO]))>><<#>>

FOUND THIS ERROR IN AUTOMATION ERROR:

Error Message:

Error encountered in step with name [PDF STEP]: Error: Task ‘PDF STEP’ Body template. Expression ‘Select(consignments Articles[Article Number],in([CONSIGNMENTS SL NO],[_thisrow-1].[CONSIGNMENTS SL NO]))’ is invalid due to: Parameter 2 of function IN is of the wrong type. Error: Task ‘PDF STEP’ Body template. Start expression ‘Select(consignments Articles[Article Number],in([CONSIGNMENTS SL NO],[_thisrow-1].[CONSIGNMENTS SL NO]))’ should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the ‘Key’ column of the referenced table. Error: The document body is empty

When inside a Start, you can just reference the [Related whatever] column in the inner Start expression. Remember that Start: changes your context to the table you are referencing records from

1 Like

Bro,

I could not understand. please explain with examples.

@SkrOYC @MultiTech @WillowMobileSys @Rifad @AleksiAlkio

I could not fix this this issue for a week. So I request you to guide me to finish this task ASAP.

Did you check this video @MultiTech posted ? I am not sure how to explain much better than this.

Single category headers in workflow templates for … - Google Cloud Community

I would like to have the pdf look better - Google Cloud Community

Grouped list from one table - Google Cloud Community

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

You may refer these for more understanding.

I have followed his video and done what he has done. but could not achieve what I want.

There is a problem with the expression which I written.

@Rifad , finally it worked. by using this expression

<<START:Select(consignments Articles[Article Number],[CONSIGNMENTS SL NO]=[_thisrow-1].[CONSIGNMENTS SL NO])>><<#>>

why it did not work when below expression was used

<<START:Select(consignments Articles[Article Number],in([CONSIGNMENTS SL NO],[_thisrow-1].[CONSIGNMENTS SL NO]))>><<#>>

1 Like

Sorry, I have been busy and just now seeing this.

The IN() function checks if a value is an element in a LIST of values. The column [CONSIGNMENTS SL NO] is likely not defined as a List type. You could wrap the value like this: LIST([_THISROW-1].[CONSIGNMENTS SL NO]), to force the IN() function to work.

But why use IN() if a straight equal comparison works?

IN() requirements

1 Like