Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Splitting the columns by Position and Length

I have a file that needs to be parsed by position and lenght of text split into columns 

           AT DATE 20-02-2020
18:00 045987 $30 56798 TRANS_SUCCESS
18:20 042397 $10.20 56798 TRANS_SUCCESS
               AT DATE 25-03-2020
18:10 045987 $13 56794 TRANS_SUCCESS
18:20 042397 $11.20 56791 TRANS_SUCCESS

 

Following are the Spec

  Header :

   AT DATE - Position 20 length 08 , Date (20-02-2020,25-03-2020) Positon :25, length 10

 Details :

   Time (18:00,18:20,18:10,18:20) - Positon 5 Length 5,

   tranactionID(045987,042397,..) :Position 12 length 7,

    Amount ($30,$10,$13 etc) :Postion 21 length 3 ,

    Receipt ID (56794,56791 etc) Postition 24, length 5

 

Can I split the column by position and length using one Column Splitter . 

  • Anonymous's avatar
    Anonymous
    5 years ago

    I solved it by using ...

     

    Splitter.SplitTextByRanges({{25,10},{5,5},{12,7},{21,3},{24,5}},false), {"AT DATE", "Time","TransactionID","Amount","Receipt"})

     

    Thanks 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    I solved it by using ...

     

    Splitter.SplitTextByRanges({{25,10},{5,5},{12,7},{21,3},{24,5}},false), {"AT DATE", "Time","TransactionID","Amount","Receipt"})

     

    Thanks