March 31, 201114 yr 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?
March 31, 201114 yr 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, 201114 yr by comment
March 31, 201114 yr Author 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.
March 31, 201114 yr Something doesn't add up, because this: Substitute ( "text%20moretext"; "%20" ; " " ) does result in this: text moretext
March 31, 201114 yr Author 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.
April 1, 201114 yr 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?
April 2, 201114 yr Author 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.
Create an account or sign in to comment