Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Replacing apostrophes in data

Hi all

Perhaps someone has come across this before and can help with my latest frustration.

Some of my data (sitting in an Access database) has apostrophes (i.e. ', as in Shari'ah) in it. For most tasks and my model, this doesn't create a problem. However, when trying to do dynamic updates, where I need to refer to the individual names, it is not finding a match because of this.

Assuming that I don't want to remove the apostrophe from the Access database, can I get rid of it at the time of importing the data, or otherwise circumvent the problem when doing the dynamic update.

Any help would be greatly appreciated.

Regards,

Joao

3 Replies
Not applicable
Author

Hi Joao,

Do you have problem in the script when you try to join that field ?

I'm not sure to well understand your question.

Regards

Giampiero

Anonymous
Not applicable
Author

Hi Giampiero

My apologies for the confusion Perhaps the following will provide some clarity.

I have no problem importing the data and using it within the model. I have a problem when running the following macro / module:

mySelections=ActiveDocument.GetSheetObject("LB60").GetPossibleValues          

For i = 1 To Portfolios.GetValueCount(1)

'               msgbox(mySelections(i-1))

R.EvaluateNoReturn "Result=r["&i&"]"

Result=R.GetSymbol("Result")

ActiveDocument.DynamicUpdateCommand ("UPDATE * SET PWeight="&FormatNumber(Result,5)&" WHERE PortfolioName='" & mySelections(i-1) &"'")

Next

It fails on the last line based on the last value below (for obvious reasons i.e. I'm using apostrophes in the statement):

Element Islamic Equity A

Kagiso Islamic Equity

Oasis Crescent Equity A

Old Mutual Albaraka Equity

STANLIB Shari'ah Equity A

Thanks again.

Joao

Not applicable
Author

Hi Joao,

no problem.

Well, you can try writing this part of your string in this way:

... WHERE PortfolioName='''" & mySelections(i-1) &"'''")

(I don't well remember if you have to put 2 or 3 " ' " )

OR

trying to use the ASCII code to replace your " ' " in the string (CHR39)

Hope it helps

Giampiero