GetPrefix As String

 

Returns the prefix (= leading characters) used with the current connection to the database.

 

We can use one single database and generate multiple versions of the Seminar.pro application, by using distinguished client identifiers, here called 'prefix'. The default prefix is "im_". This is especially meant for hosted environments where we may have access to only one database. Like that we can avoid naming conflicts by using a distinguished tablename prefix, like "im_". For example the database table addresses is by default called im_addresses.

 

When we define SQL statements to be used from a XojoScript, then we probably do not want to hardcode the current prefix in use, but use the GetPrefix function instead. Like this we can keep the XojoScript more portable. 

 

 

Returns:

 

Type

Value

Description

String

Tablename prefix

The default tablename prefix is im_

The prefix can have a maximum length of 9 characters and ends with an underscore character.

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 Used in:

 

XojoScript Name

GUID

Count participants in events

A31B7E5A-7D69-4B60-9434-23A7FE1B8F0B

Import ISR payment file

52C27AC4-24B7-4B7D-9107-6223B4E10E45

Show ISR Payment List

F4277528-5AC4-4590-9048-DA5322E69481

Print Addresslist in Word

A0503557-7DB7-4CC0-B08B-31005A0B1879

Save As Excel sheet : participants list

E50602AA-F1F7-42E6-A44A-78456DD9B778

Record delete from databox

E8AC18FC-3956-42B8-AF94-86CF7FA5B10E

 

Hint: You can find more 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 '%GetPrefix%'

 

Example XojoScript:

 

// Count participants in events

Dim sql As String

Dim Records() As String

Dim total As String

 

 

sql = "SELECT Count(*) Total FROM " + GetPrefix + "link_adr_evt " _

+ "WHERE id_evt = " + Str(GetCurrentID)

 

// Store Results in Array

Records = SQLSelect(sql)

 

// Proceed if we have received any records

If Ubound(Records) > -1 Then

 

// If we produced an error, the returning record

// starts with the String : "ERROR"

 

If Left(Records(0),5)="ERROR" Then

MsgBox Records(0// Display warning

 

Else

total = Records(0)

 

SetText("imTF_evt_Registrations",total)

 

End If

End If