Hello Qlik Community,
It seems having an incomplete understanding of single quoting mechanics has been a nagging problem for me, and impacted routines and logic based around file system based iterations, set analysis syntax, variable interpretation syntax, and output file storage formats.
Single quotes seem to have a variety of interpretation formats and I would like to know how to control their settings, but having searched for documentation on this for a while, and haven't found anything. Is there a way to control the handling of single quotes within scripting/set-analysis/output text formatting?
I have an application that takes the standard recursive file iteration For..each.. next loop from the QlikView help manual. On my personal machine, this iteration loop has no problems consuming directory trees that are embedded with single quotes.
However, when I run this at client or job sites (both on local desktops and remote connected servers), I get a variety of behaviors. Sometimes the STORE to .txt output does or does not include wrapping the entire outside of the full output row with double quotes. Sometimes it places a single quote in front of an existing single quote in an "escape character" sense.
This results in some likely bizarre syntax where each variable is then being checked for single quotes and replacing the problematic characters with "innocuous" ones.. (i.e. Let myGoodVar = Replace(myWorrisomeVar,chr(39),chr(5000)); )
Making matters more difficult, I cannot use quotes around the variable as Replace('$(myWorrisomeVar)',chr(39),chr(5000)) because in the event the variable string contained 1 quote, the output has performed 3 replacements.
Within the .QVW itself, in my example you can see the application has parsed the directories and filenames correctly, single quotes don't seem to have "derailed" the process, but I am finding when I use this iterator in various environments, sometimes the single quotes "activate" and present some sort of interpretation issue within the script iterations, and at other times the disruptive behavior lies "dormant". This often applies to script variable interpretation, where a string like (James's) will load into QlikView as (James''s).
I know when we import a file via the Text file wizard we are asked for quoting options like "Standard | MSQ | None" but I haven't seen how to apply any type of quoting instructions for script interpretation or file output. Does anyone know what settings can adjust these? Is this a QV versioning thing? A server/os setting? A QV setting? Appreciate your assistance on this.