If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#53534 by kklosson
Fri Mar 20, 2020 9:58 pm
I have a feature where users upload a document. If the document name includes an apostrophe ( ' ), such as "Jim's Statement.doc", it's a legit filename in most operating systems and it uploads fine. But trying to download it results in an error. I can't figure out how to use REPLACE_PATTERN for this since I must enclose the apostrophe within apostrophes, and this doesn't seem to fly. I am also not sure if this will work on a document attribute since the document is the whole blob and I'm not sure if the replace_pattern function would be addressing the filename or the data. Perhaps I need a Java script to catch it at file selection on the client. If so, I need someone to write that for me. $$
#53535 by BobK
Fri Mar 20, 2020 10:19 pm
kklosson wrote:I have a feature where users upload a document. If the document name includes an apostrophe ( ' ), such as "Jim's Statement.doc", it's a legit filename in most operating systems and it uploads fine. But trying to download it results in an error. I can't figure out how to use REPLACE_PATTERN for this since I must enclose the apostrophe within apostrophes, and this doesn't seem to fly.


Try the following to remove the apostrophe:
Code: Select allREPLACE_PATTERN(BO.Attribute, '\x27', '')


FYI: 27 is the ASCII hex code for the apostrophe(').


kklosson wrote:I am also not sure if this will work on a document attribute since the document is the whole blob and I'm not sure if the replace_pattern function would be addressing the filename or the data. Perhaps I need a Java script to catch it at file selection on the client. If so, I need someone to write that for me. $$


Can't help you here. Try it and report back your results.
#53538 by hpl123
Sat Mar 21, 2020 12:35 am
kklosson wrote:I have a feature where users upload a document. If the document name includes an apostrophe ( ' ), such as "Jim's Statement.doc", it's a legit filename in most operating systems and it uploads fine. But trying to download it results in an error. I can't figure out how to use REPLACE_PATTERN for this since I must enclose the apostrophe within apostrophes, and this doesn't seem to fly. I am also not sure if this will work on a document attribute since the document is the whole blob and I'm not sure if the replace_pattern function would be addressing the filename or the data. Perhaps I need a Java script to catch it at file selection on the client. If so, I need someone to write that for me. $$


Try using a SystemSettings attribute where you have the ' i.e you do REPLACE_PATTERN(FilledForm.Form, SystemSettings.CharApo, ' ' ). Written ad hoc so syntax may be wrong.
#53548 by kklosson
Sat Mar 21, 2020 4:16 pm
I am able to solve my problem using the RENAME DOCUMENT action. However, there remains a need to search for an apostrophe in a text string and I cannot figure out how to do it.
#53549 by eagles9999
Sun Mar 22, 2020 2:06 am
This works for me....

MyData.CleanString=REPLACE_PATTERN(MyData.ApostString,`'`,``)
#53555 by BobK
Mon Mar 23, 2020 3:23 pm
In my original posting, I was just showing the format for the REPLACE_PATTERN function.
The complete action would be:
FilledForm.Form=REPLACE_PATTERN(FilledForm.Form, '\x27', '')

If that is what you did, what was the error you got? The above worked for me.

Mark's suggestion should also work.
#53556 by kklosson
Mon Mar 23, 2020 3:32 pm
Okay and thanks all. I did not realize that ` (the backward thingie under the tilde) could be used in place of ' (apostrophe). I learned something useful!

Who is online

Users browsing this forum: Majestic-12 [Bot] and 36 guests