I haven't looked at third-party solutions much and so the only product I am aware of that can apply different masters during a merge would be InData by Em Software. I suspect there are others too. However, I am uncertain it would actually work in your stated work-flow. And it is outside of your target price.
I dont know whether what i understood is correct, but what you can do is convert that data record into three different records based on your requirement and then apply each data record to the corresponding layout. Separation into three files can be done with any suitable programming language. In case you dont know that, provide me your data file and i will try my best to provide you with 3 different files.
Splitting it into three separate data merges would work, but would result in three separate output files that would have to be merged. Recreating the original sequence manually would be tedious.
A simpler solution would be to have all three masters invoked as part of the data merge. Each data record would create three pages in the merged document. Then the manual task is to delete the "wrong" pages. Still time-consuming, but less tedious than merging three documents.
But neither approach as simple as what I think could be implemented relatively easy in InDesign: Allowing the choice of master to be determined by data within the record.
I have used different ID files for different layouts manually before. Page start numbers need to adjusted in each file. But combining them in Acrobat isn't a big deal.
And I suppose one could use the book feature, though I prefer not to. As well, once merged one can make a master document and place the resultant ID files in it. If I recall, I did this once. And if I recall, I needed to import the masters into it first. But my memory is hazy on that. It was when first introduced (CS3 I think).
Unless I am missing something, merging the documents in Acrobat would be tedious. Data records can be in any order: A, A, A, B, A, C, B, A, B, C, B, B, B, B, A, C... If I make an ID file for A's, and one for B's, and one for C's, I'd have three output files: A, A, A, A, A, A; B, B, B, B, B, B, C, C, C. I can combine the output easily enough, but that would mean having a file with: A, A, A, A, A, A, B, B, B, B, B, B, C, C, C. I would then have to figure out where to drag each page. For more than a few records, this would get unwieldy.
If I put in all three masters so that each record results in 3 pages of output, it would look like this (with the lowercase letters representing the "bad" pages): A, b, c, A, b, c, A, b, c, a, B, c, A, b, c, a, b, C, a, B, c, A, b, c, a, B, c, a, b, C, a, B, c, a, B, c, a, B, c, a, B, c, A, b, c, a, b, C. I think it would take much less time to delete the unwanted pages
Well, beyond a commercial plug-in, it will simply be manual work no matter how you do the merge, I think. My use of separate merges are basically different sections within the eventually combined file (whether combined in ID or Acrobat) which change, but they are in reading order.
What are the master page elements? From what little I can understand you are changing master pages within logical sections. The only solution apart from manual labor is the above plug-in (I think). Without knowing what it is about the layout changes (master pages), that's all I can contribute. Sorry.
Conceptually what I want is for the 10th field in my data record to tell InDesign which master page to use before merging the data from that record.
Triggering a master using data merge... no, at least not from InDesign only. VDP software such as XMPie (i pick this because I have used the trial version) can do this, BUT it doesn't fulfil the next requirement of being <$100, and I don't think you will find ANY VDP solution for that.
Instead, I would suggest an alternative. Rather than triggering a master page, I would suggest making a frame in the background of the page that uses a data-merge image field, so if you are changing letterheads mid-stream based on the data in the job, this will work. The catch is, there's no way indesign's data merge will trigger this by itself based on the data in the file. Instead, the data would have to include an additional field that reflects the relevant page background, and if using an excel spreadsheet to make the data, would require some creative if/else statements.
So it is possible. It slows down the processing of the file tremendously, and I'm not sure how many records are being merged.
So far as is it scriptable? Yes, most things are scriptable in InDesign. Is someone going to volunteer to prepare such a custom-script for nothing... unlikely.
The format needs to change page by page, not section by section.
I appreciate your efforts. The current "documentation" for Adobe products makes it difficult to research a topic like this without turning to the community. I'm glad the community exists and has so many people, like you, willing to lend a hand.
Thank you. I wasn't looking for someone to write the script -- just didn't want to waste time looking for something that wasn't there. I haven't written any scripts for ID, but have written plenty for Photoshop -- which should give me a head start with ID scripting.
I got this project done using the brute force method. That gives me some breathing room to write the script so that the next time around, I can let the computer do the grunt work.
Yep, after seeing your diagram of the pages, I understood the page by page thing. I was just writing about what I typically see when I need to use different masters.