Creating Plugin XML Files
- <TemplatePrefix> (Optional). This is used to limit the initial list of Word templates in the File Open dialogue when the plug-in is launched. If no value is given then a list of all Word documents in the user’s plugins folder will be shown.
- <SQLString>: Used only with SQL configurations. This method is used for more complex mailmerges containing multiple connected objects and/or data selection criteria (WHERE clause). It is also possible to use custom database functions with this method to format or combine data in a field. Configurations with <SQLSTring> can only be used with online server connection.
- <DataColumns>: Used only with DataColumns configurations. This method is used for more simple mailmerge operations and can be used in off-line mode without a connection to the server. Columns for the selected object type are listed in the same way as would be used with the VintageObject.get_value() method.
SQL Configuration
Word templates must contain mail merge fields matching the SQL defined column names after @.
Example:
<?xml version="1.0" encoding="utf-8"?>
<BusinessLetter_Mailmerge_Structure>
<TemplatePrefix>MailMerge</TemplatePrefix>
<SQLString>
select C.id,
C.name,
C.realname,
C.zip,
C.city,
C.streetaddress,
P. id,
P.lastname,
P.firstname,
P.title,
UP.lastname,
UP.firstname,
UP.title,
UP.email
from (select * from vineyarddb.vy_person_view where status = 'B') p,
(select * from vineyarddb.vy_company_view where status = 'B') c,
(select * from vineyarddb.vy_person_view where status = 'B') up,
(select * from vineyarddb.vy_company_view where status = 'B') uc,
(select fromobjectid, targetobjectid from vineyarddb.vy_connection_view where status = 'B' and connectiontype = 1) con,
(select fromobjectid, targetobjectid from vineyarddb.vy_connection_view where status = 'B' and connectiontype = 1) ucon
where p.id = con.targetobjectid (+)
and c.id (+) = con.fromobjectid
and up.id = ucon.targetobjectid (+)
and uc.id (+) = ucon.fromobjectid
and p.id = @?ID_
and up.id = vineyarddb.vyutilapi.userid
@C_ID_/i @C_NAME_ @C_REALNAME_ @C_ZIP_ @C_CITY_ @C_STREETADDRESS_
@P_ID_/i @P_LASTNAME_ @P_FIRSTNAME_ @P_TITLE_
@UP_LASTNAME_ @UP_FIRSTNAME_ @UP_TITLE_ @UP_EMAIL_
</SQLString>
<DataColumns></DataColumns>
</BusinessLetter_Mailmerge_Structure>
DataColumns configuration
Word templates must contain mail merge fields matching the DataColumn field names defined by <MergeFieldName>.
Example:
<?xml version="1.0" encoding="utf-8"?>
<BusinessLetter_Mailmerge_Structure>
<TemplatePrefix> MailMerge </TemplatePrefix>
<SQLString></SQLString>
<DataColumns>
<Column>
<VineFieldName>1->VY_COMPANY.ID</VineFieldName>
<MergeFieldName>C_ID</MergeFieldName>
</Column>
<Column>
<VineFieldName>1->VY_COMPANY.NAME</VineFieldName>
<MergeFieldName>C_NAME</MergeFieldName>
</Column>
<Column>
...
<VineFieldName>ID</VineFieldName>
<MergeFieldName>P_ID</MergeFieldName>
</Column>
<Column>
<VineFieldName>LASTNAME</VineFieldName>
<MergeFieldName>P_LASTNAME</MergeFieldName>
</Column>
<Column>
<VineFieldName>FIRSTNAME</VineFieldName>
<MergeFieldName>P_FIRSTNAME</MergeFieldName>
</Column>
<Column>
...
<VineFieldName>CurrentUser.LASTNAME</VineFieldName>
<MergeFieldName>UP_LASTNAME</MergeFieldName>
</Column>
<Column>
<VineFieldName>CurrentUser.FIRSTNAME</VineFieldName>
<MergeFieldName>UP_FIRSTNAME</MergeFieldName>
</Column>
<Column>
...
<Column>
<VineFieldName>CurrentUser.1->VY_COMPANY.NAME</VineFieldName>
<MergeFieldName>UC_NAME</MergeFieldName>
</Column>
<Column>
<VineFieldName>CurrentUser.1->VY_COMPANY.REALNAME</VineFieldName>
<MergeFieldName>UC_REALNAME</MergeFieldName>
</Column>
</DataColumns>
</BusinessLetter_Mailmerge_Structure>
Comments
0 comments
Please sign in to leave a comment.