Two people work with Invantive Composition for Word, and it helps to keep them apart. The **modeller** writes the template: an ordinary Microsoft Word or Microsoft PowerPoint file with the running text in it, a handful of [[Possible instructions|instructions]] where data belongs, and a [[Edit Model|model]] which says where that data comes from and what has to be asked of the user. The model is stored inside the document, so the template is one file. The modeller works from the [[Modeller|Modeler tab]]. The **user** opens that template, answers the questions the model poses, and receives a document in which the instructions have been replaced by data. From there it is an ordinary document: it can be read, corrected, added to, and then archived or sent. The user works from the [[Usage|Invantive Composition tab]]. ## What Happens on Composing Composing runs in one pass over the document: - The parameters are asked of the user, in the order the model gives them, with a list of allowed answers where the model offers one. - The document is read from beginning to end. Text is passed through unchanged. - A `value-of` instruction is replaced by the value of its [[Expressions|expression]]. - A `foreach` instruction runs its query and repeats the text between its two tags once per row. Repetitions inside it run per row of the row above, so their queries may use a value of that row. - A repetition which begins and ends within a table row repeats the row, so a table grows with the data. What comes out is a document without instructions in it. Nothing refers back to the database: the data is in the text. ## Where the Template Lives A template is a file and can be kept wherever files are kept: on a drive, in a document management system such as SharePoint, or published so that others can find it from within the product; see [[Publish]]. The composed document goes the same way. It can be saved as a Word or PowerPoint file, as PDF, or placed in a document management system; see [[Archive Document]]. ## Where the Data Comes From All data is fetched through [[Invantive UniversalSQL/Invantive UniversalSQL|Invantive UniversalSQL]], so a template works on any platform reachable through it. Which of them is used is decided by the database connected to, not by the template: the same template runs against another company by connecting to another database or by choosing another partition.