2 Replies Latest reply: May 15, 2014 9:55 AM by Mike Urbonas RSS

    Removing unwanted characters after a trap

    donh _

      I am working on Monarch 7 / Win 2000

       

      I have several reports in which the department numbers and descriptions are the same for all the reports except one.  This report puts a hyphen between the account and the description (I would like the final result to be: account number "space" description).

       

      For consistency, is there any way to remove a space and a hyphen after making a trap or some way to define the fields to eliminate the excess not needed.

       

      For example,

       

      11300 - INVENTORY (as in the report)

       

      convert to

       

      11300 INVENTORY

       

      Thanks

        • Removing unwanted characters after a trap
          Grant Perkins

          Hi and welcome,

           

          I assume all the other combinations have just one space between the account number and the accouint name? Very annoying as you almost certainly have to assume that all the fields need to be processed.

           

          One way or another you are looking at creating a calculated field to replace the extraction or extractions made for the table. There are several ways to do what you need to do.

           

          Have you extracted the account number and the description as one field or two separate fields?

           

          If as one field you can remove the hyphen using the STRIP function. But you will be left with a double space instead of a single space.

           

          The space scanrio can be resolved by splitting the account number off the front of the field (see the LSPLIT function) and the doing removing the leading spaces from the second part of the field using the LTRIM function and then concatenataing them together once again with a space.

          [font="courier"][Fields Part1]" "[/font][/quote]There is also the RSPLIT function to consider and the TRIM and RTRIM functions.

           

          (NB. For any Version 8 users reading this - you could so this but version 8 has some additional functions which should make the process simpler in most cases.)

           

          If you are already picking the fields separately you need only process the NAME field before concatenating with the number field.

           

          [font="courier"][number field]" "(LTRIM(STRIP(,"-"))) /font[/quote]Should give you what you want. Providing none on the have valid hyphens that you need to retain later in the string.

           

          The 'Single Field' solution could be worked almost the same way if you first split the field into 2 parts based on the first space after the number.

           

          Have a look at the Functions References in the Help files. Also you should find a Functions Reference document in PDF format for download from the Datawatch web site.

           

          If none of these suggestion are suitable let us know and we can get into the trickier stuff ...       :cool: 

           

          HTH.

           

           

          Grant

          • Removing unwanted characters after a trap
            Mike Urbonas

            As a sidenote: Monarch V8 users can combine the Strip function as noted by Grant with the InTrim function, which replaces instances of multiple spaces in a text string with single spaces.  InTrim also removes leading and trailing spaces.

             

            So the best Monarch V8 formula to turn data such as:

             

            11300 - INVENTORY

             

            to:

             

            11300 INVENTORY

             

            is:  InTrim(Strip(Fieldname,"-"))

             

            Regards

            Mike Urbonas

            Product Marketing Manager

            Datawatch Corporation