FMReader Posted March 31, 2011 Posted March 31, 2011 This threw me for a loop. I have a simple substitute calculation. I want to exchange the HTML %20 in a text string with a space. I have escaped the "%" with a backslash and that works fine... but when I substitute "\%20" with " ", the "20" part doesn't substitute. I get the following result: ...something like abcde\%20fghi turns into abcde 20fghi. I want it to become abcde fghi. (If it matters, this is Filemaker Pro 10 Advanced.) I don't get it. It's a text string. It should treat the numbers the same as any other text shouldn't it and remove them... or am I missing something obvious?
comment Posted March 31, 2011 Posted March 31, 2011 (edited) There is no need to escape anything here: Substitute ( YourHTML ; "%20" ; " " ) should work just fine. something like abcde%20fghi turns into abcde 20fghi. Well, that's very strange, because using your formula the result should be "abcde%20fghi" (no change from the original). Perhaps there's something you haven't told us about. --- BTW, a backslash is "\", not "/". But it makes no difference here. Edited March 31, 2011 by comment
FMReader Posted March 31, 2011 Author Posted March 31, 2011 Here's the string I passed to the calculation (via a user input box): text%20moretext Here's the calculation: Substitute ( UserInput; "\%20" ; " " ) And here's the result: text 20moretext The desired result is: text moretext. Hmmmm, I thought the % had to be escaped (with a backslash) because the calc wasn't working but I get the same result either way. I still don't understand why the "20" is still in there.
Fitch Posted March 31, 2011 Posted March 31, 2011 Something doesn't add up, because this: Substitute ( "text%20moretext"; "%20" ; " " ) does result in this: text moretext
FMReader Posted March 31, 2011 Author Posted March 31, 2011 It does for me too. But when I put it in a script and feed "text%20moretext" into the "Show Custom Dialog" box script step, the space is correctly substituted for the % sign but the "20" is still mysteriously there. Does that Show Custom Dialog input window do something I don't understand? Just to provide some context... the user will be copying and pasting Firstname%20Lastname from a Web browser into the database.
comment Posted April 1, 2011 Posted April 1, 2011 But when I put it in a script and feed "text%20moretext" into the "Show Custom Dialog" box script step, the space is correctly substituted for the % sign but the "20" is still mysteriously there. Mysterious indeed. Could you post a demo file showing this?
FMReader Posted April 2, 2011 Author Posted April 2, 2011 Mysterious indeed. Could you post a demo file showing this? That turned out to be more complicated than I expected. There are a lot of dependencies in the calculations in this script. It does many other things, including searching to see if the entry already exists, starting a new one if it doesn't, stripping leading and trailing spaces (separate calculation from the one that is be-deviling me). Everything works great and has been working for some time, except the calc that takes out the % sign but not the number. I'll try to separate it out and pare it down, but it's not trivial.
Recommended Posts
This topic is 5042 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now