8 Replies Latest reply: May 15, 2014 9:51 AM by Grant Perkins RSS

    Trapping Question-Need Help

    Cort_Employee _

      One of the *.PDF files I have(before Importing into Monarch) is clean.

       

      However, After Importing, while most of the data are in line perfectly, some of the lines are pushed far off to the right.

       

      Here's an example:

       

        

      25-1234517    1      45.5        46.7     43.8

      26-8745632    2      45.5        51.21    53.50

      25-1234517    1      45.5        46.7     43.8

      26-8745632    2      45.5        51.21    53.50

      25-1234517    1      45.5        46.7     43.8

      26-8745632    2      45.5        51.21    53.50

      25-1234517    1      45.5        46.7     43.8

      26-8745632    2      45.5        51.21    53.50

      This line is pushed far to the right-->30-9874563    5     45.6  45.8   50.20

      /quoteI can't seem to find the feature in the text where you can trap this last line along the Same Lines with the other data. The floating trap doesn't seem to work.

       

      Does anyone have suggestions on this?

       

      Thank You.

        • Trapping Question-Need Help
          Grant Perkins

          Hi,

           

          It sounds lke you have found another interesting anomaly hiding in a PDF file which make something that looks perfect behave otherwise when converted.

           

          What sort of result do you get if you try to use Adobe PDF reader to save as a text file?

           

          I think the better approach would be to seek to fix the import problem if possible. Have you tried the adjustments available during PDF import and did they have any effect on this particular problem?

           

          Following on from that have you installed the most recent V8 update (8.02) in case that offers some assistance?

           

          If all else fails one approach would be to import every line as a complete line rather than separate fields, strip off the spaces that would appear at the beginning of the lines when they are indented, and then create calculated fields to extract the data columns as you require them. Not a pretty solution but very effective and from the examples of data you posted there are not too many fields to grab, so little effort required to develop that sort of solution if needed.

           

          Fixing the initial interpretation would still be the favourite option though.

           

          HTH.

           

          Grant

          • Trapping Question-Need Help
            Data Kruncher

            There are issues here similar to  [url="http://mails.datawatch.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=001155#000000"]another PDF related post.[/url]

             

            Part of Grant's proposed solution relates to trapping the whole line then using calculated fields to disseminate the various fields.

             

            What if you were to trap the whole line as suggested and simply export the whole works out to a text file? Then you could make (hopefully only a few) edits to clean up the alignment, save your work, and open the text file in Monarch, and model it as you would normally? In theory, you'd probably avoid creating a whole bunch of split and other string manipulation functions.

             

            Just a thought.

             

            In the end, though, Grant's right. The best solution is to get the PDF right in the first place. You might want to consider contacting Gareth about having his team look at the PDF file. They have confidentiality forms and such if necessary.

             

            Kruncher

            • Trapping Question-Need Help
              Cort_Employee _

              Thank You for the Replies.

               

              I read the post on the link above concerning modifying it in Adobe Acrobat, but I went to the Document menu, and didn't find it(I have version 7.0, FWIW).

               

              Where will I be able to contact Gareth and his team to look at my PDF file?

               

              Thanks!

              • Trapping Question-Need Help
                Grant Perkins

                Originally posted by Cort_Employee:

                Where will I be able to contact Gareth and his team to look at my PDF file?

                 

                Thanks! [/b][/quote]Hi,

                 

                Probably the best way to contact Gareth is through a Private Message. He does monitor what is happening in the Forum but I think may be a little busy on a few things at the moment to be doing so every day. Any of the 'stickies' posted by Gareth Horton at the top of the forum should provide a link to send him a PM.

                 

                If it is the sort of file that can be shared (and is not to big) I would be happy to take a look at it to see if there is anything that might be possible using other resources but I think Gareth and the team might be interested to investigate anyway.

                 

                HTH.

                 

                 

                Grant

                • Trapping Question-Need Help
                  Mike Urbonas

                  (1) If you don't yet have Monarch V8 Pro, it's definitely worth upgrading from V7.  V8 (including V8.02 maintenance upgrade online, free for V8 users) offers vastly improved PDF conversions which may solve this issue right off the bat.

                   

                  (2) Another plan, which I believe Grant may have alluded to, is to create a blank detail trap and paint the ENTIRE row as one field.  Then do a calculated field using LTRIM (or, if it does not affect the data you want, use V8's INTRIM) to remove the blank spaces preceding each line of data.  Then hide the original column of data, and export only the calculated field as text.  You now have your PDF data as text plus the preceding spaces removed.

                   

                  Mike

                  • Trapping Question-Need Help
                    Grant Perkins

                    Originally posted by Mike Urbonas:

                    (2) Another plan, which I believe Grant may have alluded to, is to create a blank detail trap and paint the ENTIRE row as one field.  Then do a calculated field using LTRIM (or, if it does not affect the data you want, use V8's INTRIM) to remove the blank spaces preceding each line of data.  Then hide the original column of data, and export only the calculated field as text.  You now have your PDF data as text plus the preceding spaces removed.

                     

                    Mike /b[/quote]Exactly that Mike  - I seem to recall I learned the idea from you!   :cool: 

                     

                    Although IF the resulting re-aligned data 'field' now gives consistent results with all required columns neatly separated by spaces (or something identifiable as a usable separator proxy) I think I would reach for the LSPLIT function right away with one eye open for a possible consideration of RSPLIT or other functions.

                     

                    It would still be preferable to seek an adjustment that helps get to a first time aligned import if possible though.

                     

                      smile.gif[/img] 

                     

                     

                    Grant

                    • Trapping Question-Need Help
                      Cort_Employee _

                      Thanks for the tips everyone.

                       

                      This one is a very tricky report. We are currently switching to a new system, and Monarch 8.0 has been very effective with all the other reports.

                       

                      However-I tried this trick you all mentioned-now, the lines that were initially indented way to the right...these lines become WAY indented to the left for most of the fields. Here's an example...

                       

                        

                       

                      123345  Bob Jones   $555.12   123987

                      FAR RIGHT-->12345 Steve Michaels $222.13 123986

                      /quoteThe Result after Blank Trapping everything, and then LTrim-ing them in the Table...

                       

                        

                       

                      12345   Bob Jones            $555.12   123987

                      12335   Steve Michaels $555.12 123987

                       

                      /quoteCouldn't format it like the result was-but fields #3 and #4 for the 2nd Record Weren't Aligned with the first one, although the fields #1 and #2 Were.

                       

                      Anyone have any further suggestions?

                      • Trapping Question-Need Help
                        Grant Perkins

                        Ah, names - further complications.

                         

                        I would be tempted to look at the LSPLIT and RSPLIT functions to break up the line into component parts  splitting on the spaces BUT names, unless you are lucky enough to always have a first name and last name ONLY  scenario, will likely cause additional complication.

                         

                        Have you firstly tried just an LTRIM on the fields to remove only the leading spaces on the indented lines? INTRIM might be useful in many situations but I suspect not in this one. So if you used that it could be part of the problem (but I can't be sure as I suspect what I can see on the screen is not exactly what you have to deal with.)

                         

                        Your first sample did not show any names, which suggests that the file you are manipulating has a fair amount of variation to it?

                         

                        Without the names but with leading spaces removed, one thing you might consider is is exporting the file to a fixed width text file, using space as a separator. The use the new text file as the basis for a model to do the analysis.

                         

                        To be realistic I think the best way forward, given that there are many approaches which could be tried, would be if you could provide an example of the file that a few of could experiment with to see if the cause of the problem becomes evident.

                         

                        Any possibility of that?

                         

                         

                        Grant