4 Replies Latest reply: May 15, 2014 10:09 AM by Olly Bond RSS

    Varying Trap

    bminer _

      Hi Guys,

      Have a question.  I'm working on extracting some data from a PDF report.  It imports into Monarch fine, except the issue I'm having is that the system that the file comes out of never seems to give me a consistent file.  Basically, the margins are changing on me all the time, so my trap is never is the right place, and subsequently all my fields then are off.

       

      The easy fix in my mind, if I could do it somehow, would be to trim each line, getting rid of the extra spaces on the beginning that are throwing everything off, because the fields always line up, its just the margin that is my problem. Only I'm not sure how to do something like this.

       

      Any suggestions?

        • Varying Trap
          Data Kruncher

          One technique that you might want to try involves capturing the entire line as a single field. As you've said that everything basically lines up properly, this might work for you.

           

          Just paint a single field to capture the entire line and then in the Table use calculated fields to slice and dice the separate fields using SubStr and/or LSplit and such. Depending upon your structure, this might take a bit of work, but as with most Monarch work, that's a one-time effort.

           

          v10 has an auto-trim feature that might have helped in this case, but your profile says that you're using v9.

            • Varying Trap
              bminer _

              one issue i run to if i do that is the data length of the field.  its larger than 254 characters?  is there work-arounds for this?

               

              and btw, is that max field length bigger in v10?

                • Varying Trap
                  Data Kruncher

                  No, maximum field width hasn't changed. So you're correct, text fields, be they Character or Memo, can only be 254 wide.  One "trick" sometimes used, iirc, is to combine multiple Character fields into a Memo field to build a string longer than 254 characters.

                  • Varying Trap
                    Olly Bond

                    Hello bminer,

                     

                    No, the limit in v10 for a text field is still 254 characters. However, you can paint the trap line with multiple fields , and then define a calculated field of the Memo type as + etc.

                     

                    There are useful trim(), ltrim(), rtrim() and intrim() functions that can help here also.

                     

                    Best wishes,

                     

                    Olly