Jump to content
Server Maintenance This Week. ×

Inserting "*S" into a find request via a script - keeping the "s


Recommended Posts

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

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 by comment
Link to comment
Share on other sites

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

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 thoughScript.jpg.267fc2d707d68accce9cea643297b79e.jpg

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.