Click or drag to resize

IDatabaseSubstituteTemplateVars Method

Substitutes template variables in the source string, returning the result. Assumes the current user.

This function will replace template variables in a string with the specified information, e.g. replace the <name> template variable with the text "SuperOffice AS". If you want to create your own template systems, you can access our substitution engine using this function. This will fill the values based on the logged in user.

Read More

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
string SubstituteTemplateVars(
	string SourceString,
	int lContactId,
	int lPersonId,
	int lProjectId,
	int lDocumentId,
	bool bIsMailMergeDraft = false,
	bool bUseHtmlBrackets = false,
	bool bIsUrlEncoded = false
)

Parameters

SourceString
Type: SystemString
The string containing the template variables
lContactId
Type: SystemInt32
lPersonId
Type: SystemInt32
lProjectId
Type: SystemInt32
lDocumentId
Type: SystemInt32
bIsMailMergeDraft (Optional)
Type: SystemBoolean
bUseHtmlBrackets (Optional)
Type: SystemBoolean
bIsUrlEncoded (Optional)
Type: SystemBoolean
DEFAULT FALSE, TRUE if SourceString is an url. If true you will get ANSI encoding.

Return Value

Type: String
String – the text with the template variables replaced
Examples

Replace template variables

This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.

VB
dim objSO
set objSO = CreateObject("SuperOfficeDB.Database")
enUrlEncodingANSI = 2
enUrlEncodingUnicode = 3
If not (objSO is nothing) Then
    objSO.Login "USERNAME", "PASSWORD"
    str = "Dear <atfn>, have <name> received our offer? " & vbCrLf & "Best regards <auth>"
    MsgBox objSO.SubstituteTemplateVars(str,2,2,1,1, False, False, False),, "Url encoding template variables false"
    MsgBox objSO.SubstituteTemplateVars(str,2,2,1,1, False, False, True),, "Url encoding template variables true"

    MsgBox objSO.SubstituteTemplateVarsEx (str, 2, 2, 1, 1, 0, 0, 0, 4, false, false, false, false),, "Url encoding template variables false"
    MsgBox objSO.SubstituteTemplateVarsEx (str, 2, 2, 1, 1, 0, 0, 0, 4, false, false, true, false),, "Url encoding template variables true"

    MsgBox objSO.SubstituteTemplateVarsUrlEncoding (str, 2, 2, 1, 1, 0, 0, 0, 4, false, false, enUrlEncodingANSI, false),, "Url encoding template variables ansi"
    MsgBox objSO.SubstituteTemplateVarsUrlEncoding (str, 2, 2, 1, 1, 0, 0, 0, 4, false, false, enUrlEncodingUnicode, false),, "Url encoding template variables unicode"    

else
    msgbox "unable to connect to database"
end if
set objso = nothing

See Also