Slater Posted September 13, 2023 Share Posted September 13, 2023 Hi All, Probably a no go - but what I want to do is insert "*S" into a find request via a script - but keep the "s. So all of this →"*S"← is input via the script. Of course, when I script it: Set Field ""*S"" then it thinks it's inputing "" & *S & "" which doesn't work. Is there a way to do this? Thanks for any tips Link to comment Share on other sites More sharing options...
comment Posted September 13, 2023 Share Posted September 13, 2023 (edited) I have read this several times and I am still not sure I understand it. If (as my best guess leads me to believe) you want to set a field to some text that includes quotes, e.g. "*S" you must escape the literal quotes in the calculation that returns the text: "\"*S\"" Alternatively, in your example you could also use: Quote ( "*S" ) but you must be careful with this method because the Quote() function does more than just add quotes. Your title mentions "inserting". Setting a field using the Set Field script step is not "inserting". If you like, you can use the Insert Text step instead. Here you can specify the text directly, with no need for escaping. However, there are other limitations that apply. All of this has nothing to do with find requests. The rules for setting a field are the same regardless of the current mode. 1 hour ago, Slater said: Of course, when I script it: Set Field ""*S"" then it thinks it's inputing "" & *S & "" I don't think so. If you try to set a field to: ""*S"" you will get an error and you won't be able to close the calculation window. Edited September 13, 2023 by comment Link to comment Share on other sites More sharing options...
Slater Posted September 13, 2023 Author Share Posted September 13, 2023 Thank you Comment for replying to me. And apologies for not being more clear. I have the need to perform a find on a set of records. The string that I want to search for is *S. I want to do this via a script. So I was running into problems when I was using Set Field within the script, because as you say Quote you will get an error and you won't be able to close the calculation window. But your suggestion to use Quote "\"*S\"" within the Set Field works perfectly, and means that I get the whole of the string that I want to be used within the Find! Thank you very much for that little piece of magic Link to comment Share on other sites More sharing options...
comment Posted September 13, 2023 Share Posted September 13, 2023 15 minutes ago, Slater said: The string that I want to search for is *S Wouldn't it be sufficient to set the searched field to: \*S ? Link to comment Share on other sites More sharing options...
Slater Posted September 13, 2023 Author Share Posted September 13, 2023 How I've now got it set up works perfectly, thank you. Can you tell me how it works, I can't readily see how Set Field "\"*S\"" actually inputs "*S" into the field. Quote Wouldn't it be sufficient to set the searched field to: \*S As per the above, I don't know the syntax of what it's doing. I tried this but Set Field wouldn't take it. Thanks though Link to comment Share on other sites More sharing options...
comment Posted September 13, 2023 Share Posted September 13, 2023 (edited) 24 minutes ago, Slater said: Can you tell me how it works See the explanation here (esp. the 6th item in Notes). 24 minutes ago, Slater said: I tried this but Set Field wouldn't take it. See the attached. Find*S.fmp12 Edited September 13, 2023 by comment Link to comment Share on other sites More sharing options...
Recommended Posts
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