IBM Support

Script to Escape Single Quotes (') in data items for a PowerPrompts Application.

Troubleshooting


Problem

Data contains single quotes, for example: Act'N'Up Fitness 1. When selecting data that doesn't contain single quotes the application works fine. However, selecting a data item that contains single quotes results in an error. The script that the PowerPrompts Application is currently using is - if ( GetUserVarAsString("TestName") != undefined && GetUserVarAsString("TestName") != "" ) { GetQuery().AndFilterBy("[Customer Name] = '" + GetUserVarAsString("TestName") + "'"); } Error Message - Error in line:GetQuery().AndFilterBy("[Customer Name] = 'Act'N'Up Fitness 1 '") Text in expression does not match any known function or operator. Found at or near N' Error in line: GetQuery().AndFilterBy("[Customer Name] = 'Act'N'Up Fitness 1 '") Expression is invalid. Possible type mismatch. Found at or near [Customer Name] = 'Act'N'Up Fitness 1 '

[{"Product":{"code":"SSTQPQ","label":"IBM Cognos Series 7 PowerPlay"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"PowerPrompt","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF033","label":"Windows"}],"Version":"Cognos 8 BI Report Studio 8.1;PowerPrompt 7.0","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Report Studio","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SSTQPQ","label":"IBM Cognos Series 7 PowerPlay"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"PowerPrompt","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SS6G84","label":"IBM Cognos Analytics on Cloud"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Historical Number

122329

Document Information

Modified date:
13 January 2026

UID

swg21337855