AnsweredAssumed Answered

Defintion query with apostrophe name

Question asked by Pi-Hellz on May 29, 2015
Latest reply on Jun 2, 2015 by Pi-Hellz

Hi,

 

I'm trying to create an sql expression with a variable "arrondissement" but there's a problem with some attributes that contain apostrophe (quote) in their names like :

 

Baie d'Urfé or L'île-Bizard-Sainte-Geneviève.

 

I've try a few things but i'm always getting an error due to the apostrophe. It's work fine with other names that doesn't have quote.

 

lyr.definitionQuery = '"Arrondisse"' + "=" + "'" + arrondissement + "'"
or
lyr.definitionQuery = '"Arrondisse"' + "=" + "'\"%s\"'" %(arrondissement)

 

Thanks you for your help

Outcomes