We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

Checking white space properties

How to check if a text field is not empty or white space string?
I'm using condition

Code: Select all

NOT DATABASE_PROP
to check if it is not empty.
But I don't know which condition must be used for checking white space strings.
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Checking white space properties

Hello,

In order to achieve that, you can use a condition as it follows:

Code: Select all

(NOT DATABASE_PROP) AND (DATABASE_PROP = " ")
The above condition is equivalent to:

- the property exists and its' value is " " (an empty space)

However, if you want to check if there are multiple whitespace characters in a string (stored in a property), you might need to use a custom action for that.

For instance, a way of achieving the above is through a PowerShell script. The script may look something as it follows:

Code: Select all

// get the value of the DATABASE_PROP property in a variable
$property = AI_GetMsiProperty DATABASE_PROP

// check if the variable contains spaces
if (($property -match " ") -eq $true)
{
// set a property if the variable contains spaces. This property can further be used to form a condition.
AI_SetMsiProperty CONTAINS_SPACES true
}
For more information about the above script, please have a look over the following articles:

How to set an installer property using custom actions

PowerShell Inline Script Custom Action

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”