Percent (%) symbol in PowerPac function parameters

Topics related to using ToolBook for building web apps.

Percent (%) symbol in PowerPac function parameters

Postby Clifton » Tue Jan 24, 2017 7:11 am

Applies to all versions of ToolBook < v11.5
(NOTE: This problem was fixed in ToolBook version 11.5.)

PROBLEM: If you set a string parameter for a PowerPac function that ends in a "%" (percent symbol), the exported book will fail to load when it attempts to execute the function code. Here is a typical example:
    Image 4.png
    PowerPac Parameter Example
    Image 4.png (12.54 KiB) Viewed 3932 times
REASON: A bug in ToolBook treats the highlighted parameter as a mathematical expression using the modulus operator. Since as a math expression it is incomplete, it generates a JavaScript error and the book either fails to load or generates some kind of error or just freezes when it attempts to execute the action.

SOLUTION: If the parameter allows for a comma-separated list of values, then simply add a comma after the percent symbol. If that is not possible, then make sure the % symbol is NOT the last character in your string (though a space will not suffice to be the last character to prevent the problem).

The BEST solution is to enter a string expression where the % symbol is concatenated by itself to the end of your string. This will prevent ToolBook from attempting to perform math on the expression. See the example below:
    Image 5.png
    Parameter FIXED!
    Image 5.png (12.42 KiB) Viewed 3932 times
Clifton
Site Admin
 
Posts: 731
Joined: Tue Jan 14, 2014 1:04 am

Return to Web (DHTML) Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron