Each line has a return character at the end. I have to put sequential numbers at the beginning of each line, either by calculation or script. There must be a previous solution, but I don't seem to be entering the correct words to find it.
Set Variable [ $text ; table::yourfield ]Loop Set Variable [ $i ; $i + 1 ] Set Variable [ $newtext ; List ( $newtext ; $i & " " & GetValue ( $text ; $i ) ) ] Exit Loop If [ $i = ValueCount($text) ]End LoopSet Field [ table::yourfield ; $newtext ]
Set Variable [ $text ; table::yourfield ]
Set Variable [ $i ; $i + 1 ]
Set Variable [ $newtext ; List ( $newtext ; $i & " " & GetValue ( $text ; $i ) ) ]
Exit Loop If [ $i = ValueCount($text) ]
Set Field [ table::yourfield ; $newtext ]
You could also write a recursive custom function that will do all of this in the calculation engine.
If you have FMP advanced, you can make use of the custom function included in the attachment.
If you don't have it, you can use the script included as well.
Your answer is correct as well - thought I could click on both as correct. Thanks so much.
Thanks for the quick answer.
you can mark other useful answers as "Helpful".
Here's one more example of a custom function that seems to work. This one puts a period and a space after the number. (Thanks to Dale Miller)
Number_Lines (input, start)
If (not is empty (input);
start & ". " & GetValue (input; 1) & if (ValueCount (input) > 1;
¶ & Number_Lines (MiddleValues (input; 2; 99999) start + 1)); ""
download again the solution I posted, it allows you to define freely the separator between the number and the line (it can be space + ")" + tab + ". " or whatever you want.
Yes, I saw that. Just wanted to point out I'd done it in that last sample, which is no better than yours, just slightly different.
Sent from my iPod
Retrieving data ...