Description
I’m struggling with an issue in my AppSheet app where the PDF generated by a bot isn’t displaying the LineItemID values from related SaleItems records, even though the data is visible in the AppSheet data preview. I’d really appreciate your expertise to help me resolve this.
Details
- App Context: I’m building a Sales invoice system with two main tables:
- Sales: Contains columns like
InvoiceNumber,InvoiceDate,PatientID,TotalAmount,Discount,FinalAmount,PaymentMode, andInvoicePDFLink. It has a virtual columnRelated SaleItems(type: List, formula:REF_ROWS("SaleItems", "InvoiceNumber")) that lists related sale items. - SaleItems: Contains
LineItemID(key),InvoiceNumber(Ref to Sales),ItemID,Category,BatchNumber,ExpiryDate,MRP,Quantity,Discount, andLineTotal. TheInvoiceNumberlinks each sale item to a specific invoice. - Goal: Generate a PDF invoice that includes
LineItemIDvalues (and eventually other details likeItemID,Quantity, etc.) from theSaleItemstable for each invoice. - Issue: The PDF shows
InvoiceNumberand summary fields correctly, but the section forLineItemIDvalues remains blank, despite the data being present in the preview.
What I’ve Tried
I’ve attempted the following steps without success:
- Basic Template with Loop: Used
<<Start: [Related SaleItems]>> - <<[LineItemID]>> <<End>>in the template, but it showed nothing. - SELECT Expression: Switched to
<<Start: SELECT(SaleItems[LineItemID], [InvoiceNumber] = [_THISROW].[InvoiceNumber])>> - <<[LineItemID]>> <<End>>, which also resulted in a blank section. - Rebuilt the Bot: Created a new bot from scratch with a “Data Change > Adds only” trigger on the Sales table, a “Create a PDF” task, and a fresh Google Docs template. The template included the
SELECTexpression, and the PDF was saved toInvoicePDFLink, but still noLineItemIDvalues. - Manual Sync and Delay: Manually synced the app and added a condition (
COUNT(SELECT(SaleItems[LineItemID], [InvoiceNumber] = [_THISROW].[InvoiceNumber])) > 0) to ensure data was available, but the PDF remained blank. - Template Recheck: Recreated the template section manually, reuploaded it, and cleared browser cache, yet the issue persisted.
- Alternative Columns: Tested with
<<[Quantity]>>instead of<<[LineItemID]>>, but that was blank too. - Logs and Permissions: Checked the bot execution logs (no clear errors) and verified table permissions, but found no issues.
Help Needed
I’d love your guidance on:
- Why the
Related SaleItemsloop andSELECTexpression aren’t pulling data into the PDF, even though it’s visible in the preview. - Any potential misconfigurations in my bot, template, or table relationships that I might have missed.
- Alternative approaches to display related
SaleItemsdata in the PDF (e.g., different expressions or workarounds). - Suggestions for debugging this further, especially if it’s an AppSheet-specific issue.
Additional Information
- AppSheet Version: Latest (as of April 21, 2025).
- Data Source: Google Sheets.
- Observation: The bot runs successfully, and the PDF generates with other fields (e.g.,
InvoiceNumber), but theItemssection is empty.
Thank you in advance for any insights or solutions you can offer. I’m happy to provide more details or screenshots if needed!
Best,
atypicaldoc