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.

Thank you

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.

Thank you

Via script:

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 Loop

Set Field [ table::yourfield ; $newtext ]

You could also write a recursive custom function that will do all of this in the calculation engine.

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)); ""

)

Via script:

You could also write a recursive custom function that will do all of this in the calculation engine.