22 Replies Latest reply: May 15, 2014 10:05 AM by Olly Bond RSS

    Grab data between 2 items, Help Please

    ZacTechz _

      I have a report that needs excess data removed, or grab only the data needed.  Each new "section" of the report starts with a header and based on that header I will either need the data below it or not.  The problem is the data below the header is all over the place in terms of fields, size..etc.  But there is always a footer to every section.  How do I indicate I want everything in between the two?

       

      I was able to do this with TextPipe Pro evaluation pretty easily, but we bought Monarch Pro specifically for this.  Any help or tips would be great!

        • Grab data between 2 items, Help Please
          Grant Perkins

          Halo ZacTechZ and welcome to the forum.

           

          From Waht you write my mental image of your report is something like

           

          Header Stuff

          -


          The body of the report containing a mass of

          infomation

              in no

                   particular or consistent structure

          -


           

          A footer section.

           

           

          -


          oOo----


           

          Is that about it?

           

          Is this formated information in the style of a structured report or more like an information dump along the lines of a CSV file?

           

          And do you want to grab everything in the unstructured 'body' section?

           

          Do you think of the body section as just a mass of information one or more lines long?

           

          Or is it a number of lines each of which might be considered a 'Detail' template in Monarch?

           

          Or is it maybe more like sets of detail records which can cover more than one line for each record?

           

           

          If you have the possibility to post a small sample of a report to help illustrate the challenge that would be great. Use the CODE tags to keep the report formatted when posting. See [URL="http://www.monarchforums.com/showthread.php?t=2290"]here[/URL] for assistance if you are not familiar with these tags.

           

          HTH.

           

           

           

          Grant

            • Grab data between 2 items, Help Please
              ZacTechz _

              This is roughly what it looks like, some of the formating was messed up when I ripped the data out.  Essentially this sample has 2 "sections" the first one is what I want.  The header that defines that I need it is "AT 00:00AM 00/00/00 AT TEXT  TT  BY NAMETEXT" .   The 2nd section is split on 2 pages so it also includes the 3 line page header.  The 2nd section's header is "AUTOMATICALLY GENERATED IN 00/00/00 UPDATE"  That is a section I do not want to see.  All sections are split by the line of ******. 

               

              NUM:               ###### CREATED MISCELLANEOUS 1 FOR TEXTARY TEXT NAME A NAME                                                                       SOURCE: TEXT

                                    AT 00:00AM 00/00/00 AT TEXT  TT  BY NAMETEXT                                                                         LAST CHANGED: 00/00/00

                 

              -FIELD DESCRIPTION-                      -NEW INFORMATION-

               

              NAME 1:                                  FULL NAME

              NAME 2:                                  FULL NAME

              NAME 3:

              ADDRESS LINE:                            ADDRESS

              CITY:                                    CITY              ST  ZIP

              PRIORITY CODE:                           TEXT

              RESPONSIBILITY CODE:                     CODE NAME

              DESCRIPTION 1:                           TEXT

              DESCRIPTION 2:

              DESCRIPTION 3:

              DESCRIPTION 4:

              DESCRIPTION 5:

               

              ************************************************************************************************************************************

              NUM  :               ###### DELETED LOTS OF TEXT AS;DFLKJA;SDLFKJA;LSDKFJAS;DLFKJALSKDJFS;LAS                                                         SOURCE: TEXT

                                    AUTOMATICALLY GENERATED IN 00/00/00 UPDATE                                                                            LAST CHANGED: 00/00/00

               

              -FIELD DESCRIPTION-                       -DELETED INFORMATION-

               

              NAME 1:                                  NAME

              NAME 2:

              NAME 3:

              ADDRESS LINE:                            ADDY

              CITY:                                    CITY          ST  ######

              TAX ID OWNER:                            ##############

              EXPIRATION DATE:                         00/00/0000

              ACCOUNT TYPE:                            TEXT

              ACCOUNT NUMBER:                          000000000000

              FIELD:                                       

               

               

              TEXT                                                           TEXT                                                                               PAGE:          2

              TEXT                                                           TEXT                                                                           RUN DATE: 00/00/0000

              TEXT                                                           TEXT                                                                     PROCESSED THRU: 00/00/0000

               

              NUM:               LOTS OF TEXT A;LSDKFJ;ALSKDFJ;ALKSDFJ;LAKSDJF;LAKSDJF;LKAJSDF;LKAJSDFJKSDL;K                                                       SOURCE: AUTO

                                    AUTOMATICALLY GENERATED IN 00/00/00 UPDATE                  (CONTINUED)                                               LAST CHANGED: 00/00/00

               

              -FIELD DESCRIPTION-                       -DELETED INFORMATION-

               

              FIELD:

              STUFF:                          .####

              STUFF:

              STUFF:

              STUFF:                                STUFF

               

              ************************************************************************************************************************************

              /CODE

                • Grab data between 2 items, Help Please
                  Olly Bond

                  Hello Zac,

                   

                  Thanks for the sample. If you define a page header to take the three lines out of the way, then a multi-line detail template with advanced field properties to pick out each field on the preceding string condition should do the trick.

                   

                  You might try trapping on the *** line but probably the first regular field NAME1 would work as well.

                   

                  HTH,

                   

                  Olly

                    • Grab data between 2 items, Help Please
                      ZacTechz _

                      Thank you so much for your help, but I think my main problem is this program still confuses me.  My current understanding is I can only identify fields to be extracted to the table or summary view.    Can you give more detailed info on how I remove the page headers from the report or point me to a step by step guide?

                        • Grab data between 2 items, Help Please
                          Olly Bond

                          Hello Zac,

                           

                          Monarch won't let you change the report itself. That stays as it is. It's the trusted source of your information.

                           

                          If you want to produce a text file that looks like your report but without the page header stuff, you can do it by trapping the data you need using templates.

                           

                          This will create a table of data in Monarch's table window. To then turn that back into something like the original report would need you to create a summary with some hidden key columns and export this as a fixed width text file.

                           

                          HTH,

                           

                          Olly

                            • Grab data between 2 items, Help Please
                              ZacTechz _

                              Ok, that helps.  The part I am stuck on is the data below Feild description is never the same, can vary to just a Name or just a address field, or 50 items.  Do I have to define every possibility? or is there a way to have it capture everything till the line of *******

                                • Grab data between 2 items, Help Please
                                  Grant Perkins

                                  The structure of the report looks usable and variations ore not necessarily a problem depending on what you want out of the extraction and what shape/format/form that needs to take.

                                   

                                  So assume for a moment that you can identify and dispose of the headers and the data you don't want. What do you want to do with the data you DO want?

                                   

                                  -FIELD DESCRIPTION-                      -NEW INFORMATION-

                                   

                                  NAME 1:                                  FULL NAME

                                  NAME 2:                                  FULL NAME

                                  NAME 3:

                                  ADDRESS LINE:                            ADDRESS

                                  CITY:                                    CITY              ST  ZIP

                                  PRIORITY CODE:                           TEXT

                                  RESPONSIBILITY CODE:                     CODE NAME

                                  DESCRIPTION 1:                           TEXT

                                  DESCRIPTION 2:

                                  DESCRIPTION 3:

                                  DESCRIPTION 4:

                                  DESCRIPTION 5:

                                  /code

                                   

                                  You have this or something that may be part of this. (I assume there will always be at least one line of usable stuff between the header and the stuff you don't want?)

                                   

                                  What do you need to do with those lines?

                                   

                                  You could extract them as they are, leaving the format as it is.

                                   

                                  You extract as above ans then rework what you get out into something more structured in a data sense.

                                   

                                  You could look at do the more structured data extraction directly into a table (and then summarize it is required .....)

                                   

                                   

                                  I think one of the problems here is that you have, as happens so often with people joining the forum, been thrown into the deep end and less usual Monarch requirement right at the start of your time with it. It will all look a little strange and meaningless, probably. Once we show you how things it together life should get easier.

                                   

                                  Were are trabnsforming some characters here, from one structure to another. Given several ways to do it it may be best to know what the required output needs to look like (at the end of the process would be best if you are actinig as a part of a relay team - we may be able to skip a couple of legs using Monarch).

                                   

                                  As a starting point, try this.

                                   

                                  Make a new template as a DETAIL template. Pull three lines for the sample data, starting with the line.

                                   

                                  -FIELD DESCRIPTION-                      -NEW INFORMATION-[/code]

                                   

                                  Trap using the words "new information" in the position they appear on the line. (I assume for now that this is a consistent position. If not we will need to tweak things a little.)

                                   

                                  On the THIRD line, where the first (and possibly only?) line of usable information might be, 'paint' a field the entire width of the report. (assumed to be less that 254 chars for our purpose here).

                                   

                                   

                                  Right click on that field , go to the ADVANCED PROPERTIES tab in the window displayed. Set and END FIELD value thatpicks up the blocks of data no matter how many lines there are. (I encourage yuo to experiment with this since to do so takes only seconds and will give you insights into what happens. 2 or 3 of the options might work for you here.)

                                   

                                  Now, if my guess is correct (based on the sample posted) you will end up with one large text field. You may need to set this to be MEMO type AND I strongly recommend that you use a FIXED FONT liked FIXEDSYS when doing this in order to retain spacing appearance as far as possible.

                                   

                                  The block of text you see may now differ from the original since the MEMO field has some special attributes for working with text. Look at is as an ordinary field first to get an idea of what you will be able to get out of the MEMO field.

                                   

                                  At this oint you should have a TABLE WINDOW that shows you have extracted a single field (maybe a large one) for each section with new data. and, hopefully(based on the sample) nothing from the rest of the report sections. Now we need to know what you want to do with it before we select the best approach for the next stage.

                                   

                                  HTH.

                                   

                                   

                                  Grant

                                    • Grab data between 2 items, Help Please
                                      ZacTechz _

                                      Ok, I think I am getting it, but I hit another bump.  It is now grabbing all that random FIELD DESCRIPTION data, but it is also grabbing it from sections I don't want.

                                      So if that sample was my full report, the only thing I want as a end result is this:

                                       

                                      NUM:               ###### CREATED MISCELLANEOUS 1 FOR TEXTARY TEXT NAME A NAME                                                                       SOURCE: TEXT

                                                            AT 00:00AM 00/00/00 AT TEXT  TT  BY NAMETEXT                                                                         LAST CHANGED: 00/00/00

                                         

                                      -FIELD DESCRIPTION-                      -NEW INFORMATION-

                                       

                                      NAME 1:                                  FULL NAME

                                      NAME 2:                                  FULL NAME

                                      NAME 3:

                                      ADDRESS LINE:                            ADDRESS

                                      CITY:                                    CITY              ST  ZIP

                                      PRIORITY CODE:                           TEXT

                                      RESPONSIBILITY CODE:                     CODE NAME

                                      DESCRIPTION 1:                           TEXT

                                      DESCRIPTION 2:

                                      DESCRIPTION 3:

                                      DESCRIPTION 4:

                                      DESCRIPTION 5:

                                      /CODE

                                        • Grab data between 2 items, Help Please
                                          Grant Perkins

                                          Zac,

                                           

                                          If you trap for "new information" as I described in my previous post you should only get the NEW section not the DELETES. This trap works for the sample you posted but it is possible that there is something else in the full report that makes it less unique. If so you need to fiand a refined version of the trap I'm afraid.

                                           

                                          For the 'header', set up an APPEND with a 3 line sample (seems consistent at 3 lines ....) and trap on the word CREATED in the first line.

                                           

                                          If the actual report has something different to the sample you may need to establish a different trap.

                                           

                                          Then either trap the block of text n the same way as for the detail or simply paint and extract the fields as you need them if they are consistently sized and positioned.

                                           

                                          Does that move you on a bit further?

                                           

                                           

                                          Grant

                                            • Grab data between 2 items, Help Please
                                              ZacTechz _

                                              First of all thanks for the quick help!

                                               

                                              I now have a better idea of what I need out of this and a slightly better understanding of this software.

                                               

                                              I understand that I need to extract the data I want for an output resembling more of a spreadsheet than a report.

                                               

                                              So my goal is a spread sheet that uses the BOLDed fields as columns and Italic fields as the data:

                                               

                                              NUM:[/B]               ######[/I] CREATED MISCELLANEOUS 1 FOR TEXTARY TEXT NAME A NAME                                                                       SOURCE: TEXT

                                                                    AT 00:00AM 00/00/00 AT TEXT  TT  BY /B[I]NAMETEXT[/I]                                                                         LAST CHANGED: 00/00/00

                                                 

                                              -FIELD DESCRIPTION-                      -NEW INFORMATION-

                                               

                                              NAME 1: /B                                 FULL NAME[/I]

                                              NAME 2:[/B]                                  FULL NAME[/I]

                                              NAME 3:

                                              ADDRESS LINE:[/B]                            ADDRESS[/I]

                                              ETC.........

                                               

                                              /CODE

                                               

                                              I can do this by making a new template and trap for every line under Field Description, and that is working great, but I need it to not capture that data for "sections" that say Automatically Generated......UPDATE. This is where I am stuck. I can grab all that data as one giant field buy trapping with the "by nametext", but I can't use the data then.

                                              • Grab data between 2 items, Help Please
                                                Grant Perkins

                                                Zac,

                                                 

                                                Have you got a sample report you could make available to me (directly, not posted on the forum) so that I could develop a coupld of models to give you some direct guidance and a few alternative approaches?

                                                 

                                                I think it would be quicker for both of us and give you an archivable reference 'document' if we could do that. Plus I would get to see a few more sample pages which would make it easier to advise about which of a number of approaches might be the best one for you to take.

                                                 

                                                If you can make a report available send me a Private Message through the forum with a direct email address that will reach you (and allow attachments) and I will send you my email address to which you can send the example report.

                                                 

                                                 

                                                 

                                                Grant

                                                  • Grab data between 2 items, Help Please
                                                    Olly Bond

                                                    Hello Zac,

                                                     

                                                    You've got the idea of report mining - turn the report into a table with the fields you want as columns. And you've got the idea of trapping - defining a template that selects all the data you need.

                                                     

                                                    Don't worry if you select too much. You can always filter the table to exclude the UPDATE records.

                                                     

                                                    Good luck!

                                                     

                                                    Olly

                                                    • Grab data between 2 items, Help Please
                                                      ZacTechz _

                                                      Zac,

                                                       

                                                      Have you got a sample report you could make available to me (directly, not posted on the forum) so that I could develop a coupld of models to give you some direct guidance and a few alternative approaches?

                                                         

                                                      Grant[/QUOTE]

                                                       

                                                      Unfortunately it will take me hours to strip out confidential information in just a small portion of the report.  Of the sample I have posted its basically those 2 types  of "sections"  the main difference is the Fields under field description. I would say there is a pool of maybe 50 field types and I only need about 10 of them (such as Name: Address:)    So if you can imagine the sample I have repeated 50 times; but I only need the data under sections that have the header AT 00:00AM 00/00/00 AT TEXT  TT  BY NAMETEXT .   

                                                       

                                                      Once again I am floored by the support in these forums! thanks a ton!

                                                        • Grab data between 2 items, Help Please
                                                          Data Kruncher

                                                          Zac,

                                                           

                                                          I built a little Excel utility to scrub/anonymize report samples so that they can be posted in the forum. So long as you can paste your existing report text into a worksheet, it's really easy to use. You can even specify that you want certain rows left alone, like for headings.

                                                           

                                                          PM me with an email address and I'll send it along.

                                                           

                                                          We'll get you squared away yet!

                                                      • Grab data between 2 items, Help Please
                                                        Grant Perkins

                                                        Zac,

                                                         

                                                        Is it safe to assume that the sections of your report all have 2 effective columns. The first column is the field 'name' and the second the value found in the field? And the columns are always in the same positions with fields starting in the same place across the line every time that particular field appears? (I'm NOT[/B] interested here in the order that the fields appear in the columns ....)

                                                         

                                                        Is it also safe to assume the the Field descriptions will be unique within each section? e.g. Name 1 will only appear once in the section for "New Information"? (But may also appear in other sections that you don't want to extract?)

                                                         

                                                        If both of the situations described above as true you should be able to get what you need directly at the field level (no need for a large block of text) by using the template TRAP to pick a start row from which to look for the fields you want (So for example make the trap match the "-NEW INFORMATION-" text above the column with the field values in it) and than identify the FIELDS you want to extract using the PRECEDING STRING feature in the FIELD PROPERTIES - ADVANCED PROPERTIES tab.

                                                         

                                                        From the look of it the 10 fields you want will always be on separate lines and appear in the same horizontal position across the line (under the 'New Information' column. I'll assume that is correct at this time.

                                                         

                                                        You need 10 fields, therefore you wall want 10 lines in your DATA SAMPLE for the template. It may be that you do not always have 10 lines for every record in that section but for now I will assume that you do just to get you started.

                                                         

                                                        So, create a template selecting 10 rows for the sample section size.

                                                         

                                                        (What follows is based on the examples for the report format you posted earlier.)

                                                         

                                                        Make the trap line the -NEW INFORMATION- text and tell Monarch that it is on LINE 4 of the 10 line sample. (Note here that the actual data selected in the sample does not matter at all in this case - but there are other cases where it does.)

                                                         

                                                        Now we will create the fields you want to extract.

                                                         

                                                        On the FIRST LINE paint a field to extract the NUM value. I am assuming here that that particular field is always in the same place. If not don't worry but keep line 1 of the field mapping window for that field.

                                                         

                                                        On line 2 create the field for the NAMETEXT data. Same comments as above.

                                                         

                                                        On the third line in the position of the right hand column (New Information) paint a field of whatever the max size might be. Right click on the field to access the properties. Click the advanced tab and in the 'start field on' section, subsection 'preceding string' enter "name 1:" (just the text to match the FIELD DESCRIPTION EXACTLY BUT IGNORING CASE, not the quote marks).

                                                         

                                                        OK that and see what you get displayed back in the template definition window. You should see a field presented throughout the report in the New Information sections only. The field should be the data for the Name 1 description.

                                                         

                                                        On the next line do the same thing but use 'name 2:' as the preceding string.

                                                         

                                                        Then on the following lines the fields with applicable preceding strings for the other field you need.

                                                         

                                                        Check that your 10 line sample block never overlaps into one of the other sections you don't want. I would suggest that you create a FOOTER template for the row of asterisks that separates the sections. That should stop the the DETAIL template searching beyond the asterisk line to find a matching preceding string when it did not find one in the first section. HOWEVER if you have a 10 line sample BUT some records may have less that 10 lines in the section the detail template will overlap the footer and the footer will not work, in which case we will need to make a few adjustments .... but we can come back to that if we need to.

                                                         

                                                        This technique is beyond 'introductory' use of Monarch so I have tried to keep it as basic as I can at this time. Don't worry if it sort of works but leaves some issues to correct, there is more that can be done. If you do have problems just tell us concisely what they are and we can pick the best approach to work around them. The important thing at the moment is to become familiar with the capabilities of the 'preceding string' feature.

                                                         

                                                        If my earlier assumptions about the format of the report are wrong then we need to take a different approach.

                                                         

                                                         

                                                        HTH.

                                                         

                                                         

                                                        Grant Perkins

                                                          • Grab data between 2 items, Help Please
                                                            ZacTechz _

                                                            Yay!  I am finally seeing what I want. 

                                                            I do have the problem where the "section" is shorter than 10 lines so its skipping past the footer and grabbing the wrong data. 

                                                             

                                                            Also I am grabbing other fields not in the sample (such as SHORT MIDDLE NAME) by selecting fields I DON'T need in the sample and changing the preceding string.   It seems to be picking up the right fileds, but I want to make sure this is an OK method to use.

                                                              • Grab data between 2 items, Help Please
                                                                Grant Perkins

                                                                Yay! I am finally seeing what I want.

                                                                I do have the problem where the "section" is shorter than 10 lines so its skipping past the footer and grabbing the wrong data. /quote

                                                                 

                                                                OK, I'll explain how to deal with that in a minute.

                                                                 

                                                                Also I am grabbing other fields not in the sample (such as SHORT MIDDLE NAME) by selecting fields I DON'T need in the sample and changing the preceding string. It seems to be picking up the right fileds, but I want to make sure this is an OK method to use.[/quote]

                                                                 

                                                                From your description I don't think you have a problem doing that. The SAMPLE selection does 2 things in most cases (see the exception though):

                                                                 

                                                                1) Defines how many lines are to be considered to be length of the template.

                                                                 

                                                                2) Provides a visual guide to the positioning of the information on the report to assist with getting the fields to be extracted in the right position in the template.

                                                                 

                                                                 

                                                                In a normal report situation is will be logical to see the template sample as the correct positional information for the extraction and work with it that way. However with the Preceding string approach the actual positioning of the fields in the sample does not matter, nor does the order of the fields.

                                                                 

                                                                Exceptions.

                                                                 

                                                                1. If you happen to be using a 'hybrid' template with some field positions based on fixed field positions and some based on preceding strings (as I think you will be using in this case), do the fixed position fields first and then use any spare lines (no fields defined) to create the preceding string based fields. The order of the preceding string based fields does not matter. The one overriding rule is that fields may not overlap. (However you could have 2 or more fields on the same line provided their horizontal positions in the report do not overlap. They would not have to be on the same line in the original report. I don't think this applies anywhere in your report based in the information provided.)

                                                                 

                                                                2. If you are using a FLOATING TRAP the sample data IS IMPORTANT and this is the one exception that very clearly relies on the sample data in the trap line to make the trap work. If you ever feel the need to use a floating trap (an FT is really intended for use with 'reports' such as log files or internet access transaction registers logs with long single line 'records' where key identifiers move position along the line) then check out the HELP and Training Guide thoroughly beforehand for an understanding of that special option.

                                                                 

                                                                ===========

                                                                 

                                                                 

                                                                OK, back to the '10 lines is too many lines' problems.

                                                                 

                                                                Firstly you need to identify how many lines your smallest section contains. Let's assume it is 6 lines.

                                                                 

                                                                You need 10 lines (one for each of the 10 fields you need to extract)

                                                                 

                                                                So, select a 6 line sample and replace the 10 line sample with the 6 line sample. Some of your previously defined fields will drop off the bottom of the new sample and be lost.

                                                                 

                                                                Now create a new template with a 4 (or 6) line sample USING EXACTLY THE SAME TRAP AS THE DETAIL TEMPLATE but making thi snew template an APPEND template. (You will have to use an APPEND template since only one detail template is allowed.)

                                                                 

                                                                Add the field lost from the original longer template to this new template using the same preceding string method. You won't need the 'fixed' fields again.

                                                                 

                                                                You should now see all 10 fields where they appear but without the overrun for the shorter record sections.

                                                                 

                                                                If you only have, say, 4 lines in the smallest record section, make a 4 line Detail template and then 2 'same trap' appends with not more than 4 lines in the sample. That will give you enough lines to define the fields you need. An interesting property of the preceding string concept is that Monarch will continue to look for a match anywhere between the start line of the detail template and the the start line of the next detail template UNLESS there is something that stops that seek occurring - like a FOOTER template.

                                                                 

                                                                Since you have V10 it would also be good to read up on the 'Cleared By' feature just in case you find you need it to prevent append template data appending to subsequent records. In theory using the identical trap for both Detail and Append(s) should eliminate this as a problem so I donl;t expect you will need it. BUT it is always good to be aware of the tools available to you just in case ....

                                                                 

                                                                 

                                                                It's worth mentioning that the approach described here has, in the past and along with other concepts, been referred to as 'Voodoo Monarch', being outside the everyday usage (for most people) and using some 'advanced' concepts. (Though they are easy to use once you are familiar with them.). I believe they are covered in the advanced training courses.

                                                                 

                                                                Every now and again new Monarch users seem to get thrown in at the deep end and I think you have been one of the 'lucky' ones.

                                                                 

                                                                Let us know if this still leaves you with problems - based on what you have told us I think you should be OK.

                                                                 

                                                                 

                                                                 

                                                                Grant

                                                                  • Grab data between 2 items, Help Please
                                                                    ZacTechz _

                                                                    I think I have what I need.  Unfortunately, my smallest section contained 1 line so I ended up having to make a trap for every field I needed.  A little more tedious work, but it’s doing what I want!  

                                                                     

                                                                    Thanks to everyone for all your help!

                                                                      • Grab data between 2 items, Help Please
                                                                        Grant Perkins

                                                                        I think I have what I need. Unfortunately, my smallest section contained 1 line so I ended up having to make a trap for every field I needed. A little more tedious work, but it’s doing what I want!

                                                                         

                                                                        Thanks to everyone for all your help![/quote]

                                                                         

                                                                        Zach,

                                                                         

                                                                        I'm interested to know how your shortest section contained only one line. The way I was interpreting your sample gave (from memory) a minimum of 3 lines IF the additions section existed at all. Does the report deliver anomolies from time to time? Or did I miss something more obvious?

                                                                         

                                                                         

                                                                        Grant

                                                                          • Grab data between 2 items, Help Please
                                                                            ZacTechz _

                                                                            Well, my trap is 3 lines but I was indicating I have to make a new trap for each value, such as Name1.  B/c some sections only have a name1 and nothing else.

                                                                              • Grab data between 2 items, Help Please
                                                                                Grant Perkins

                                                                                Well, my trap is 3 lines but I was indicating I have to make a new trap for each value, such as Name1. B/c some sections only have a name1 and nothing else.[/quote]

                                                                                 

                                                                                You have to have a field with a preceding string that captures each possible field type and it may be that with only one line of infomation on certain records you could only define three fields in a template. But that is one trap (template) for 3 fields which will only be populated IF the preceding string matches something between the trap line you use and the trap line for the next record. (And I do mean the next record not the next template.)

                                                                                 

                                                                                There is no particular harm (to observable performance or whatever) that I am aware of in having multiple templates and one field per template but the number of templates allowed is limited so in many cases one template per field might not allow you to get all of the results required. In other cases of course it may be the only way to get the results!

                                                                                 

                                                                                The point is that the preceding string concept is pretty powerful for getting at data from certain types of difficult report and it is a really useful tool to have full familiarity with when working with Monarch. But it does benefit from some solid experimentation to absorb what it can do for you.

                                                                                 

                                                                                HTH.

                                                                                 

                                                                                 

                                                                                Grant

                                                                                  • Grab data between 2 items, Help Please
                                                                                    Olly Bond

                                                                                    Hello Zac,

                                                                                     

                                                                                    As Grant mentions, there is a limit on the number of templates. I believe that it's 22 - one, and only one, detail template, again, one, and only one, page header, and then twenty more which can be a mix of appends and footers as you like it.

                                                                                     

                                                                                    Sometimes, when you are faced with a sprawling XML dump of data, you can get what you want out of it with a decent multi-line detail template and a load of preceding strings. Occasionally, the data isn't well enough behaved - too many fields to trap and too small a sample size to work with, for example.

                                                                                     

                                                                                    There is a workaround - to trap everything (make a completely generic one line detail trap), grab everything on the line, do all the work with calculated fields and filters in the table, then output a summary as fixed width text to give you a well behaved report.

                                                                                     

                                                                                    Adopting this approach might allow you a little more diagnostic information, in an automated workflow, as you could generate some useful measures in the first pass through the data.

                                                                                     

                                                                                    HTH,

                                                                                     

                                                                                    Olly