GetFileText(FieldName As String, FileName As String, RecID As Integer) As String

 

Load a text file from a filebox and return its contents.

 

This function retrieves the contents of a textfile which is stored in a filebox.

The filebox can be on the details screen of any type of modul in Seminar Pro (address, event, info, etc)

 

In the example below we are looking for a text file in a filebox which is used in Events. We pass in the name of the filebox

as a paramter and also the id of a specific event. If the parameter FileName matches with the name of a file in this filebox,

then it is copied from database to a local temporary folder, its contents is read and returned by this function.

 

 

Parameters:

 

Name

Type

Description

FieldName

String

Name of the filebox, for example: imFB_evt_Files

FileName

String

Name of the file to be retrieved from the filebox, like: AGBs.pdf

RecID

Integer

id of the the record which contains the textfile to be retrieved.

For instance the id of a specific event. In the example below we are retrieving the id of an event and storing it in the variable evt_id.

 

Returns:

 

Type

Value

Description

String

contents of textfile

The contents text of a textfile.

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Send Seminar Invoice by Email

024F872B-9E87-499F-9D2D-208C4C32E4CF

Create Seminar Reminder Invoice

A3DD8BD9-6141-44A1-AA82-5A2C78042209

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%GetFileText%'

 

Example XojoScript:

 

// Get ID of selected event in registration window

Dim evt_id As Integer = LinkList_GetID("evt")

 

// Define filename for boilerplate text, for bodytext of email to participant

Dim bodyTextFile As String = "MailTextD.txt"

 

// Retrieve  boilerplate text

Dim boilerplate As String = GetFileText("imFB_evt_Files",bodyTextFile,evt_id)  // email bodytext

 

MsgBox(boilerplate)