In test BSV, I have the following :
BO's:
. Address with attribute Name
. DocTemplate with attribute TemplateName
. DocMerged with attribute Subject, LetterDoc and reference attributes Address, DocTemplate
Queries:
. Address
. DocTemplate
Document templates:
. Templ1 with <<DocMerged.Address.Name>> and <<DocMerged.Subject>>
CreateDoc process (with Address, DocTemplate as Input):
. ENTER NEW DocMerged WITH DocMerged.LetterDoc=ThisDocTemplate.TemplateName, DocMerged.Address=ThisAddress,DocMerged.Subject=ThisDocMerged.Subject USING Main
. VIEW DocMerged USING Main
After entering Templ1 in DocTemplate and 2 address Names, the CreateDoc process requires a select Address (because of Input) and display the DocMerged form.
In the form, I can see the selected Address, the selected Templ1 and I enter some data in the Subject field. Then, I click on Create button.
Problem: the subject never gets merged in the LetterDoc document !
Merge problem in Word template
pixerp,
The problem is that DocMerged.Subject is not saved yet when DocMerged.LetterDoc merges info into the template in your ENTER NEW statement above.
Modify your CreateDoc processs to be 3 steps as follows:
1- ENTER NEW DocMerged WITH DocMerged.Address=Address,DocMerged.DocTemplate=DocTemplate
2- DocMerged.LetterDoc=DocMerged.DocTemplateName
3- VIEW DocMerged USING Main
Moving the creation of DocMerged.LetterDoc to step 2 allows the DocMerged.Subject info to be input and saved by the user during the ENTER NEW in step 1.
Hope this helps,
Tom
PS -- I don't think the THIS prefix is necessary in your CreateDoc process because only one instance of both Address and DocTemplate BOs are already in context.
The problem is that DocMerged.Subject is not saved yet when DocMerged.LetterDoc merges info into the template in your ENTER NEW statement above.
Modify your CreateDoc processs to be 3 steps as follows:
1- ENTER NEW DocMerged WITH DocMerged.Address=Address,DocMerged.DocTemplate=DocTemplate
2- DocMerged.LetterDoc=DocMerged.DocTemplateName
3- VIEW DocMerged USING Main
Moving the creation of DocMerged.LetterDoc to step 2 allows the DocMerged.Subject info to be input and saved by the user during the ENTER NEW in step 1.
Hope this helps,
Tom
PS -- I don't think the THIS prefix is necessary in your CreateDoc process because only one instance of both Address and DocTemplate BOs are already in context.