Foreach Ask Variable

Discussions related to ReadyDoc development.
Post Reply
cklahr
Posts: 71
Joined: Tue Oct 27, 2009 3:32 am

Foreach Ask Variable

Post by cklahr »

See attached document. I would like to code it that each name that is chosen should come out on a separate page. If 3 names are chosen, I want to get a separate Bankruptcy search for each individual name. Please advise. Thanks.
Attachments
my_BankruptcySearch.doc
(54.5 KiB) Downloaded 62 times
Mark McKenna

Re: Foreach Ask Variable

Post by Mark McKenna »

If a document is meant to be generated "per something", you would use the Primary Context setting of the document. Effectively, this externalizes the FOREACH ASK paradigm from the document. For example, each HUD document that ships with Select has a Primary Context of {{Order.HUD}} so that the user selects from all available/qualifying HUDs up front - before any rendering even starts. A single document selection may end up being generated multiple times, then, depending on the user's selections.

In your case, if you set the document's Primary Context property to {{Order.Contact[{{.ContactType}}="Seller" OR {{.ContactType}}="Buyer/Borrower"]}}, the user will be prompted to select for which buyers/sellers the particular document will generated. Inside your document, you simply code your fields as being relative to the contact, and at runtime it will be interpreted against each one. Of course, you can still use absolute fieldcodes to "back up" to the Order to get to the Property and Title Company info.

Hope that helps...
cklahr
Posts: 71
Joined: Tue Oct 27, 2009 3:32 am

Re: Foreach Ask Variable

Post by cklahr »

How can I code the following in a Variable:

<FOREACH ASK {{Order.Contact[{{.ContactType}}="Seller" OR {{.ContactType}}="Buyer/Borrower" OR {{.OtherType}}=”Name Search”].Person}}>

After each result I would like to have a Page Break, besides for the last one. Please advise.
Mark McKenna

Re: Foreach Ask Variable

Post by Mark McKenna »

Currently, variables only support scalar values. Array type variables are not supported, which is what I think you're referring to (e.g. set the value of a variable to a collection of objects that can be accessed later in the document).

As for the page break, you could technically try and add a physical page break inside the FOREACH block and it should be applied per iteration, but that's going to be a little touch and go, and may not end up looking the way you want. You run into issues like suppressing the "last" page break that need to be resolved. The reason, again, is that you are essentially trying to create a final document that has information broken up by the buyer/seller, which is exactly what the Primary Context paradigm is meant to address. So that is still an option worth considering. Your document becomes "per contact" and it has no FOREACH block - the user would pick from a list of contacts when the overall job is being built and your document would then render once for each one selected. Whether or not that is acceptable is dependent on your operation.
Post Reply