IsEditMode As Integer

 

Used to determine the current operation state.

 

If 1 is returned, then the user is about to update an existing record. Otherwise 0 is returned.

 

When the user has the appropriate permissions, then he can enter EditMode by either clicking on a data field in detail view, or by selecting menu EDIT, MODIFY (+M), or by clicking the pencil Icon on the toolbar.

 

Returns:

 

Type

Value

Description

Integer

1

The current state is updating.

The user has started to edit a record in databox.

 

0

The current state is NOT updating.

 

Hint: When writing XojoScripts which update the database, then we may want to verify if the user is in EditMode,

which implies that he has the appropriate rights to do so.

 

 

Available in:

 

WindowMain

WindowLink

YES

NO

 

 Used in:

 

XojoScript Name

GUID

Record update in databox

4A25A881-0947-45EF-B691-B81900C1ACEE

 

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 '%IsEditMode%'

 

Example XojoScript:

 

If (IsEditMode = 1) Then

Dim modul As String = GetActiveModul

 

If modul = "addresses" Then

 

Dim company As String = GetText("imTF_adr_OrganizationName")

Dim lastname As String = GetText("imTF_adr_LastName")

 

// Either one must be filled out, abort if empty

If lastname = "" And company = "" Then

MsgBox("Please fill out either 'Lastname' or 'Company'." + EOL + EOL + "This record has not been saved.")

 

// Cancel Saving of data

AbortUpdate("TRUE")

 

Return

End If

 

Dim label As String = GetText("imTA_adr_Label")

Dim salutation As String = GetText("imTF_adr_Salutation")

Dim linkbox As String = GetText("imTF_adr_Linkbox")

 

// Generate label, salutation and linkbox text if either one is missing

If label = "" Or salutation = "" Or linkbox = "" Then

 

// Run Script to generate label, salutation and linkbox text

RunScript("74855E25-5542-4B9D-B821-04C414425526"

 

End If  // label = ""

End If // ActiveModul = addresses

 

// Save was clicked after editing an event

If modul = "events" Then

 

// Script to update the participants counter

RunScript("A31B7E5A-7D69-4B60-9434-23A7FE1B8F0B")

 

End If

 

End If // IsEditMode