SetPropertyBool(propertyName As String, propertyValue As Boolean) As Boolean

 

Set a Boolean value of a property, which exists in the properties manager.

 

If the property is not existing yet, it will be added.

 

Select New Properties Manager from menu Script to add or remove properties manually.

 

Properties are saved to the customproperties table in the database.

 

 

Parameters:

Name

Type

Description

propertyName

String

The name of the property, as it is used in Properties Manager

propertyValue

Boolean

Boolean value, to be assigned to the property propertyName

Boolean is a data type used to store True or False.

The default value is False.

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True if the property has been set.

Returns False upon failure

 

Available in:

WindowMain

WindowLink

YES

YES

 

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

 

Example XojoScript:

 

Hint:         Use properties in order to hold a value at a single location, which then can be reused in various scripts.

                  For instance in this example we have the property PayPalAllow which serves as a global switch to

enable or disable the PayPal payment option.

 

// Retrieve currently set value

Dim currentValue As Boolean = GetPropertyBool("PayPalAllow")

 

// Prepare message for user

Dim current As String = "(current value: " + If(currentValue=True,"yes)","no)")

 

// Display current value and ask user for new setting

// 4 (Yes No) + 32 (Question mark) + 256 (second button is default)

Dim allow As Integer = MsgBox("Use PayPal option?" + eol + current,292)

 

// 6 = Yes, 7 = No

If allow = 6 Then

Call SetpropertyBool("PayPalAllow",True)

Else

Call SetpropertyBool("PayPalAllow",False)

End If