1 Reply Latest reply: May 15, 2014 10:03 AM by Grant Perkins RSS

    splitting up segment in Multi Line Trap

    Ziggy _

      Hello,

       

      I had a question, but because I had to wait to get "Approved" to post I ended up figuring it out, so I thought I'd share my solution in case it can help anyone else.  I know Monarch pretty good, but I'm sure I will pick up some pointers here.  I do have a question which I will post separately.

       

      I can't attach a screen shot, so hopefully this explains...

       

      Problem is the second line (bolded) has a variable identifier for the document type.  Solution was to Highlight the whole segment and use Extract function to pull out data based on “Constant” references in the string

       

       

      [FONT="Courier New"]H3  CASE PICK SURCHARGE                DR   0006         09.02.08       H       

      [B][B] BOL: D08281 Reference: 4000420723[/B][/B][/B]          699.         0.25 EA      174.75    

      H1  HANDLING CHARGES                   DR   0006         09.03.08       H       

      Receipt: 105605 Reference: 4540070431[/B]        2.         8.87 PLT      17.74     /FONT

       

       

      For BOL/Receipt ..(description is the field name to extract from)

       

      String....  BOL: D08281 Reference: 4000420723

       

      Formula:    Extract(description,":","Ref")

       

      Result:      D08281

      =======================================================================

       

      For Reference...

       

      String....  BOL: D08281 Reference: 4000420723

       

      Formula:    Trim(extract(Extract(Description,"Reference",),":"))

       

      Result:      4000420723

      =======================================================================

       

      For document Type:

       

      String....  BOL: D08281 Reference: 4000452576

       

      Formula:    Extract(description,"",":")

       

      Result:     BOL

       

       

      • the result is the same for a RECEIPT

       

       

      __________________________

       

      Ziggy

        • splitting up segment in Multi Line Trap
          Grant Perkins

          Hi Ziggy,

           

          That's a nice example for use of the Extract() function.

           

          Is you second line always in a consistent format other than the Document type itself and the associated reference to the document number?

           

          If so the LSPLIT() function could be useful as an alternative approach.

           

          You are only interested in the first 4 sections (actual information of interest being in positions 1,2 and 4) which can be split up by the spaces between them.

           

          By picking and comparing the first part of the split you can ascertain whether you are dealing wth a BOL: or a Receipt: and so, should that be significant for your output, allocate the values to the an appropriate field by using conditional processing - probably an IF() statement.

           

          Good work uncovering a solution while you were waiting to post! Sometimes things just seem to get focused in the mind by such events and the answer appears as if by magic!

           

          Have fun.

           

           

          Grant