If I have a regular FMP text field with multiple lines, is there a function that will return the line number (index) in the text field I'm on?
PatternCount ( Left ( myTable::myField ; Get ( ActiveSelectionStart ) ); "¶" ) + 1
Thanks Nicolai. Seems like it works better without the +1 at the end, but it works.
Wondering why there isn't a get(index) function, or similar, which abstracts this, but whatever.
Plus one will give you the actual line number, without it you will get the index, which, I suppose, you want to start from 0.
This will obviously will ignore any wrap-around in the field.
I was getting incorrect row numbers in the data viewer with the +1. I guess this is a good candidate for a new function.
I suspect that you can get different results if the cursor is just to the left of the return characters. Might need to subtract 1 from the selectionStart value.
Yeah, I was thinking that as well.
The real solution would be for the text field to understand its own state. Even with non-object based method calls, there could be another FMP function to get that current row.
Dreaming, I know.
Retrieving data ...