Doc Gen - if-loop help
Greetings,
I have a question regarding if-loops in Document Generation templates. (I need to rebuild this solution as a Dossier, but until then, I think this might be pretty simple.)
I basically have:
-an Inspections lists, which allows for 20 Inspections to be generated, for a single List Item.
-a DocGen Template that allows for 20 Inspections to be populated.
-A column named 'InspectionNumber', which is basically a counter for the total number of inspections performed.
My goal: is to have Doc Generation stop on the page that the InspectionNumber has been reached... rather than populating 9 Inspections, and leaving with 11 unpopulated pages to manually remove.
--- --- --- ---
This is the first 3 (of 21) pages of the Template...
Top of page Code:
[[if [[InspectionNumber]] >=2]]
BOPC:
[[end if]]
-- -- --
I feel like I am missing a few basic method to go about this...
Any help would be greatly appreciated!
-
There are some helping placeholders inside the loop control like [[@Loop.CurrentIndex]]; [[@Loop.Count]] you can use to check current iteration and check if current iteration index+1 is lower or equal than your [[InspectionNumber]]...
But an optimal configuration for your case would be to have Inspections is a sublist of Projects-"Dossier" from where you start the Doc Gen Action.
In that case you start the Doc Gen in Context of the Project and loop over all related Inspections (no handling of amount of inspections needed - but inspection items must be created already at this time). Your template structure could look like this then (abstract):
[[loop NameOfYourInspectionList]]
-- pagebreak --
-- Your Inspection Table with [[PlaceholdersFromSingleInspection]] --
[[end loop]]0
Please sign in to leave a comment.
Comments
1 comment