Hi,
Making myself a little nuts over here.
I have created a PDF template that uses a Start-End to loop thru a referenced list.
It works ok.
But the formatting of the pdf is a little lacking. So, I wanted to identify the 3rd item in the list and add an image to that block - this would act as a header for the 2nd page of the pdf. I can control the spacing and I know that the 3rd item will be on the top of the 2nd page.
But I canโt find a way to grab the index # of the 3rd list item in order to add the conditional statement.
Below is the code snippet. Can anyone offer a solution?
"<<If: COUNT([Related Next of Kins Active]) >0>>
<<Start: [Related Next of Kins Active]>>
My Signature
<<[Signature Image]>>
<<[First Name]>> <<[Last Name]>>, <<[Relationship]>> <<[Entry Date]>>
<>
<>
<>
"
Thanks.
Penny
Solved! Go to Solution.
So, update.
I tried Marcโs suggestion, โSELECT( [Relatedโฆ][key] , [status] = โActiveโ )โ but it failed to find the key - maybe because the virtual column is calling a slice.
But I did find a solution to the issue in the original solution -
it seems the, โ<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ wigs out if there are only 3 items in the list.
It then formats all items in the template as if they are item 4 (and its related spacing/copy).
So, I added a couple of <> statements:
<<If: COUNT([Related Next of Kins Active]) < 4>> then display regular <> / <> layout
And also
<<If: COUNT([Related Next of Kins Active]) > 3>> then use
โ<<Start: [Related Next of Kins Active]>>
<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ layout.
This seems to work.
Maybe this?
<<IF: [key-column] = INDEX( [ref-column].[Related Next of Kins Active] , 3 )>>
In general, there is no way to know the index of the START iteration, unless you insert that value into your data somehow.
My God!
It works. I would never have found that on my own. I really canโt say I completely understand it but I do get the concept.
Thank you.
Hi,
Unfortunately, this does not work when the # of items changes (make an active item inactive, for example).
I have to find a good solution using appsheet webhook/json to zapier or power automate, then generate the pdf (from a template) and save the pdf to Gdrive or save the link to the pdf to Gdrive (or appsheet).
I am going to have an aneurism trying to make formatting and start/end work well in the appsheet pdf template.
Any help w 3rd parties would be appreciated.
Penny
Why not? Can you just changed both instances of
[Related...]
to
SELECT( [Related...][key] , [status] = "Active" )
?
Hi,
I am already using a slice that pulls out the โactiveโ rows.
โ<<Start: [Related Next of Kins Active]>>
<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ
The issue seems to be that the template wigs out when the # of active rows changes. The INDEX loses the plot and my PDF ends up with this:
The code on the template is trying to format the pages by identifying when there will be a 4th active row - then, a new template page is started.
This works well until the โactive rowsโ changes (+/-).
Then the โ<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ is called for every active row on the template and includes the extra copy/spacing on the pdf for every row in the Start/End.
Resulting in this output to the pdf:
So, update.
I tried Marcโs suggestion, โSELECT( [Relatedโฆ][key] , [status] = โActiveโ )โ but it failed to find the key - maybe because the virtual column is calling a slice.
But I did find a solution to the issue in the original solution -
it seems the, โ<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ wigs out if there are only 3 items in the list.
It then formats all items in the template as if they are item 4 (and its related spacing/copy).
So, I added a couple of <> statements:
<<If: COUNT([Related Next of Kins Active]) < 4>> then display regular <> / <> layout
And also
<<If: COUNT([Related Next of Kins Active]) > 3>> then use
โ<<Start: [Related Next of Kins Active]>>
<<If: [AdditionNextofKinId] = INDEX( [CR#].[Related Next of Kins Active] , 4 )>>โ layout.
This seems to work.
Ahhh.
The 4th index of a 3-length list would return blank. Appsheet has issues comparing to blank values, they generally always return TRUE.
User | Count |
---|---|
18 | |
9 | |
8 | |
5 | |
5 |