if there will be no returns in the part to the right or the left then you can substitute the "=" with "¶" and use GetValue( the_result ; 2)
Say you have TableA with field SomeData then you do a Replace Field Contents on that field with this formula:
Left( TableA::SomeData ; Position ( TableA::SomeData ; "=" ; 1 ; 1 ) - 1 )
I believe you're after the right stem? This is an alternative:
Let ( [
t = "item=kicks" ;
pos = Position ( t ; "=" ; 1 ; 1 ) ;
l = Length ( t )
Middle ( t ; pos + 1 ; l - pos )
Result is 'kicks'
Hope this helps
this is yet another way to accomplish the same thing as above examples, but as a custom function ...
This is a simple text parser.
Replace ( val ; 1 ; Position ( val ; "=" ; 1 ; 1 ) ; "" )
Amazing, it has been there since FileMaker 6 (or earlier) and I don't think I've ever used it!
The 'start' and 'numberOfCharacters' is what is so helpful here. Also keep in mind that you can use Get(ActiveSelectionStart) & Get(ActiveSelectionSize) as these values, if your user had "selected" something to change. And you can use the Text Formatting functions:
to return the results as Bold, colored, etc. in the 'replacementText'!
very cool function(s) indeed.
I had to look it up in the FM Functions PDF (always keep this and the script reference in favourites). Its funny how often we miss these. Always use Left, Right, Middle, Position, Patterncount, etc. but couldn't believe how old this function was and I pre-date it from pre-Claris days!
I use Get(ActiveSelection.....) for pretty much exactly as you describe - although for goodness sake don't ever rely on formatted text in FileMaker if using WebDirect as you'll lose (not loose - pet hate!) the lot!
Also why these forums are worth keeping an eye on and helping out whenever we can (as you do!).
Interesting, Andy. So performing the Text Formatting functions when in WebDirect is fraught with hazards or using Text Formatting functions at all will give undesired results when viewed in WD?
At the risk of hijacking Dino's original posting, but I think he's some excellent options and despite my contribution I recommend User19752 solution - but only to wind Wim up - LOL ;-)
WebDirect has always removed formatting from text. We have a 'cobbler and shoes' internal system for monitoring our projects and have always used your suggested Get(ActiveSelection...) to script completed work by changing colour and using strikeout on the text entry. However, if you access any field and update via WebDirect, all text formatting is removed. I haven't tested v15 server with this as yet, but haven't read anything to indicate that it has changed.
We abandoned WebDirect very quickly for this purpose and immediately put in a feature request using the normal route.
OK, the "edit-while-in-WD" is what removes the formatting. I can live with that.
Also, Wim's reply is excellent (as always) and using Substitute() to replace character(s) with the return (pilcrow) is so handy and using the Value-list-type functions:
has radically changed a lot of parsing methods since they were introduced. His caveat
if there will be no returns ...
is what may well determine which functions are used. And now we are back on track with the topic for Dino.
So I add
If there will be no other "="s
Yay, back on track!
I must admit to still being sceptical about Values and Words (LeftValue, LeftWord, etc.), particularly down to unusual characters and we have some users with either 'space baritis' or 'returni keytis' - not helped by many PCs having different characteristics for the return/enter key - I wish I had a pound (probably a dollar post Brexit) for every time I've had to add a script trigger to a field to substitute pilcrows to null. I guess I"m more comfortable with the 'values' element than the 'word' but if in doubt always go back to the basics previously mentioned above.
But then again. That's just me!
By the way, and totally as an aside, I've just used another function (from v8) that I've never had reason to use before - Get(CustomMenuSetName) - must be that sort of day!