March 30, 20223 yr Newbies I'm trying to figure out a good and semi-repurposeable way to do the following. Set a variable to the contents of a field, starting with (and including) an identified string (in this case, the string is unique to the field, but to make the script more general, it can be the first occurrence of the string), to the end of the field. I then want to set the field to that the value of the variable. I probably don't even need a variable, but I have been trying to use one during testing. Set Field seems to be the best function to start with. To clarify: Field initial state: <beginningTextToEliminate> uniquestring <endingTextToKeep> Field ending state: uniquestring <endingTextToKeep> -- I started out using Set Selection, and *am* able to select the text I want the field to be set to, but with no way to set the field to that selection (I don't think I can set a variable to text selected by Set Selection): Set Selection Start Position: Position ( notes::entry ; "uniqueString" ; 1 ; 1 ) End Position: Length ( notes::entry ) -- I am able to find the Position of the start of the string: Position ( notes::entry ; "uniqueString" ; 1 ; 1 ) … but then what? Then I tried working with RightWords: I was able to manually get the content I want the field to be set to by manually entering the number of words: RightWords ( notes::entry ; 15 ) … which works, but I want to be able to write a calc that determines what those (15, or whatever) number of words are. thanks Edited March 30, 20223 yr by Bob47
March 30, 20223 yr Here is one way: Right ( YourField ; Length ( YourField ) - Position ( YourField ; "uniquestring" ; 1 ; 1 ) + 1 ) Here's another: Replace ( YourField ; 1 ; Position ( YourField ; "uniquestring" ; 1 ; 1 ) - 1 ; "" ) The first one extracts the "tail" of the text, while the latter removes the leading part. You could also do: Middle ( YourField ; Position ( YourField ; "uniquestring" ; 1 ; 1 ) ; Length ( YourField ) ) but that's kind of clunky. Edited March 30, 20223 yr by comment
March 30, 20223 yr Author Newbies I tried all three methods, and all work perfectly. I appreciate your help, and a bonus for providing multiple options. Thanks! Edited March 30, 20223 yr by Bob47
Create an account or sign in to comment