1 Reply Latest reply on Dec 15, 2010 10:37 AM by philmodjunk

    Split text box by lines

    daveealex

      Title

      Split text box by lines

      Post

      I have some data that is in a single text box (not by my choice)that looks like this:

      ABARTH
      Grande Punto 1.4 T-Jet 16V: 12/07 626
      500 1.4 T-Jet: 8/08 635
      500 1.4 T-Jet 16V: 3/09 641
      ACMA
      Vespa 400: 1/58 24
      AIXAM
      400 Mac: D4 Scooter&minicar (6/99)
      400 Super Luxe: D4 Scooter&minicar (6/99)
      500.4 SL: 11/02 565
      ALFA ROMEO
      145 1.4i TS 16V L: 1/97 495
      145 1.6 L: 8/94 466
      145 1.7 16V: 1/95 471
      145 1.9 JTD L: 10/99 528
      145 1.9 TD: 10/97 504

      as you can see there are headers. These are car manufacturers (ABARTH, ACMA, AIXAM, etc). The line below the header are models and descriptions. I am looking for a way to split this line by line and paste into another database so that each record has atleast the model and description stopping at the':'. If possible I would like to keep the Manufacturer.

      Example:

      Alfa Romeo Alfa Romeo

      145 1.4i TS 16V L

      145 1.6 L

      I can not find a way for a script to go from one line to the next. I hope there is a way to do this.

      David

        • 1. Re: Split text box by lines
          philmodjunk

          Loop
             Set Variable [$I ; Value: $I + 1]
             // at this point you can use GetValue ( yourtable::yourtextfield ; $I ) to access a line of text in the field
             Exit Loop If [ $I = ValueCount ( Yourtable::yourtextfield ) ]
          End Loop

          At the point where you see // is where you'd insert the steps you need to work with a given row of text in the field. You might use Set Field or Set Variable to copy the line into another location, use an If step to check the value at that line, or...?