docs

Home All functions Legacy functions Categories

TokenMergeInFile()

Clarion prototype

Prototype: TokenMergeInFile(*CSTRING InSourceFile, *CSTRING InTargetFile, *CSTRING InToken, *CSTRING InReplacement, LONG InFlags), SIGNED, PROC, PASCAL, RAW, NAME(‘TokenMergeInFile’)

Purpose

Reads text from a source file, replaces token text, and writes the merged result to a target file.

Parameters

| Parameter | Type | Description | |—|—|—| | InSourceFile | *CSTRING | Source text or HTML file to read. | | InTargetFile | *CSTRING | Target file to write. Use a different file when you want to preserve the source template. | | InToken | *CSTRING | Full token text to replace, such as [[FirstName]]. | | InReplacement | *CSTRING | Replacement value to insert. | | InFlags | LONG | Merge option flags. 0=Replace all, case-sensitive, 1=First only, 2=Ignore case, 3=First only and ignore case. |

Return value / error codes

Example (Clarion)

rc          LONG
srcFile     CSTRING(260)
outFile     CSTRING(260)
tokenText   CSTRING(80)
valueText   CSTRING(256)
flags       LONG

srcFile   = CLIP(PATH()) & '\Template.html'
outFile   = CLIP(PATH()) & '\Merged.html'
tokenText = '[[FirstName]]'
valueText = 'Charles'
flags     = 0

rc = TokenMergeInFile(srcFile, outFile, tokenText, valueText, flags)
MESSAGE('TokenMergeInFile rc=' & rc)

Notes

Home All functions Legacy functions Categories