Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My load script ran fine and the data are being loaded correctly. However, there's one section in the script where the scripts are in red highlight and I can't seems to fathom what's exactly went wrong, I think its a 'best practice' kind of problem? Can anyone help me check what's wrong with my script?
Appreciate any help!
Yes, is the PurgeChar. I replaced the double single quotes for anything else and the red part disappeared. It is just a bug in the code editor.
I'm using Qlik Cloud - it looks a little better:
So, in this case you can replace the '' with Chr(39) and it will look fine. Same result but looking better!
Test:
LOAD * INLINE [
TestString,
"'12345,'12356",
"'14'535,'5434",
"'890'39,'3453",
"''67''39','3456",
"'123,'123"
];
PurgeTest:
Load
*,
SubField(PurgeChar(TestString, Chr(39)), ',', 1) as PurgeString
RESIDENT Test;
DROP TABLE Test;
Regards,
Mark Costa
Insert spaces between the quotation marks, where the parameter is passed in the PurgeChar function.
PurgeChar([CustomerCode],' '' ')
- Matheus
check in the script above if you not missing any ";"
It may be from a previous Section of your code since everything is red. can you confirm that please?
Hi @MatheusC, thanks for the reply. Adding spaces does cleared out the red highlights, but doesn't this means it will remove empty spaces in the string as well? What if my main purpose is just to remove any quotation found in the string? For example, if my string is '123 '456 and I want the output to be 123 456, doesn't PurgeChar([CustomerCode],' '' ') removes the empty space as well and results in 123456?
Hi @TcnCunha_M, thanks for the reply. I checked and there's no missing ';'. The script can run and load data just fine.
Hi @marksouzacosta, thanks for the reply. Doesn't seems to be the case since the script run and load data fine, and only this section has red highlights on the code. I think maybe its the single quotations configuration in the PurgeChar function?
Maybe. What platform are you using? QlikView or Qlik Sense? And which version? Maybe this is just a visual bug. Can you share the script with us please?
Qlik Sense, on the latest May update. The whole script is fine just except for this particular section and the script snippet I shared in the post. I attached a sample script with the exact same problem.
Yes, is the PurgeChar. I replaced the double single quotes for anything else and the red part disappeared. It is just a bug in the code editor.
I'm using Qlik Cloud - it looks a little better:
So, in this case you can replace the '' with Chr(39) and it will look fine. Same result but looking better!
Test:
LOAD * INLINE [
TestString,
"'12345,'12356",
"'14'535,'5434",
"'890'39,'3453",
"''67''39','3456",
"'123,'123"
];
PurgeTest:
Load
*,
SubField(PurgeChar(TestString, Chr(39)), ',', 1) as PurgeString
RESIDENT Test;
DROP TABLE Test;
Regards,
Mark Costa