Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
poklegoguy
Creator
Creator

Load script run fine but having red highlights

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?

image.png

Appreciate any help!

Labels (1)
1 Solution

Accepted Solutions
marksouzacosta
Partner - Specialist
Partner - Specialist

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:

marksouzacosta_0-1720066638343.png

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

Read more at Data Voyagers - datavoyagers.net

View solution in original post

10 Replies
MatheusC
Specialist
Specialist

Insert spaces between the quotation marks, where the parameter is passed in the PurgeChar function.

PurgeChar([CustomerCode],'  ''  ')


- Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
TcnCunha_M
Creator III
Creator III

check in the script above if you not missing any ";"

As you think, so shall you become.
marksouzacosta
Partner - Specialist
Partner - Specialist

It may be from a previous Section of your code since everything is red. can you confirm that please?

Read more at Data Voyagers - datavoyagers.net
poklegoguy
Creator
Creator
Author

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? 

poklegoguy
Creator
Creator
Author

Hi @TcnCunha_M, thanks for the reply. I checked and there's no missing ';'. The script can run and load data just fine.

poklegoguy
Creator
Creator
Author

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?

marksouzacosta
Partner - Specialist
Partner - Specialist

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?

Read more at Data Voyagers - datavoyagers.net
poklegoguy
Creator
Creator
Author

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. 

marksouzacosta
Partner - Specialist
Partner - Specialist

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:

marksouzacosta_0-1720066638343.png

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

Read more at Data Voyagers - datavoyagers.net