7 Replies Latest reply: May 15, 2014 10:07 AM by Grant Perkins RSS

    Trap on Characters

    anloisel _

      I am trying to figure out a way to trap on "Part Numbers" starting with F and P. I am not sure how to specify only character "F" and "P".

       

      Is this something that can be done in a trap or will I have to filter out what is not needed?

       

      Here is a data example.

       

      Part Nbr     Type

      F00002-T     

      F00002-T     F

      F00002-T     I

      F00002-T     N

      F00002-T     O

      F00002-T     S

      F00002-T     U

      F00002-T     X

      F00003-5     C

      F00003-5     F

      F00003-5     I

      F00003-5     N

      F00003-5     S

      F00003-5     U

      P00067     S

      P00068     C

      P00068     F

      P00068     I

      P00068     N

      P00068     S

      P00068     U

      P00069     C

      P00069     F

      P00069     I

      P00069     N

      P00069     S

      P00070     C

      P00070     F

        • Trap on Characters
          RalphB _

          Hi anloisel and welcome to the forum

           

          Probabley the best way based on your version of Monarch is to capture all the rows you need and use a filter to extract only the ones that start with F or P.

            • Trap on Characters
              anloisel _

              Hi anloisel and welcome to the forum

               

              Probabley the best way based on your version of Monarch is to capture all the rows you need and use a filter to extract only the ones that start with F or P.[/QUOTE]

               

              Thank you for the quick reply Ralph.

               

              Is there a way of doing this in a more recent version?

                • Trap on Characters
                  Data Kruncher

                  No, a single trap position can only specify a single letter (if the regular Alpha trap isn't used).

                   

                  If your dataset is potentially large enough that time required to load it all and subsequently filter it to isolate only the F and P records could be onerous, then I'd consider creating an "F" model and a separate "P" model.

                   

                  Each would force Monarch to only capture the appropriate data and would perfrom the capture much more quickly.

                   

                  Otherwise, a filter using:

                  Left(,1)="F" .Or. Left(,1)="P"[/CODE]

                   

                  should do the trick as Ralph implied.

                    • Trap on Characters
                      Olly Bond

                      Hello anloisel,

                       

                      Your example data appears to only have F & P records in. If you had data like:

                       

                      Part Nbr     Type

                      F00002-T     

                      P00002-T     F

                      Z00002-T     I

                      Z00002-T     N[/CODE]

                       

                      then you could use a NOT trap on the the Z character. This feature was introduced only in v9, I think.

                       

                      HTH,

                       

                      Olly

                        • Trap on Characters
                          Grant Perkins

                          I can't check right at this moment but I think V8 include the .IN. operator for calculated fields in which case an alternative to Kruncher's formula would be something like ...

                           

                          Left(,1).IN.("F", "P")[/code]

                           

                          If you needed to offer this sort of selectivity in several versions for different users - perhaps with user entry of the 'codes' required - this formula should allow you to set up a User field, prompted as they run the process or set in a script for batch processing, which allows the values in the ("F","P") section to picked up from the user entered field, thus making the single formula reusable.

                           

                          This is probably a step further than you need at this time but it seems to be worth mentioning it here for those who may visit this thread in the future.

                           

                           

                          HTH.

                           

                           

                          Grant