11 Replies Latest reply: May 15, 2014 9:56 AM by Dee Moore RSS

    Preceding String

    LARRYG _

      If I have a five line detail template and set a trap on the first line, as a condition for the other lines, and a preceding string using the Advanced tab, for lines 2 - 5, will the trap on line 1 be ignored? I believe that is the case when using a preceding string trap. If so, it would be a great enhancement if it would look at both conditions when using the Advanced tab.

       

      Total for Group xxx Paid Amt:

                          Prior   :

                          Checks  :

                          Voids   :

                          Net     :

       

      Total for Group xxx Paid Amt:

                          Checks  :

                          Voids   :

                          Net     :

       

      Total for Group xxx Paid Amt:

                          Prior   :

                          Checks  :

                           

      Total for State xxx Paid Amt:

                          Prior   :

                          Checks  :

                          Voids   :

                          Net     :

       

      Trap T for Total and G for Group

      create field for Paid Amt, create field for Prior and add preceding string "Prior" as a second conditon since prior may not always appear. Same is true for lines 3 - 5.

        • Preceding String
          Grant Perkins

          Your idea should work fine with the Group and Paid amount fields being consistently available and the others variable. Preceding string is not part of the record trap but will report the contents of the fields where, and only where, the preceding string exists somewhere between the trap first line for one record and the first line for the next trapped record, no matter how many lines that may be except that ...

           

           

          ... if your sample used 5 lines for the template yet the SMALLEST number of lines in a record is LESS than 5 lines, as in the case of your 4 line (3 lines plus a blank line) record in the sample format you posted, you will find that some records will be missed because the sample overlaps the first line of a genuine record.

           

          So to function as you require the line sample selection of the template must not be a greater number of lines than the smallest record you are likely to find.

           

          That means you don't have enough lines to define all of the preceeding string based fields you require.

           

          To get around this it should be possible, in your example at least, to use 3 or 4 lines in a detail template and then add any remaining possible fields into an APPEND template which uses exactly the same trap as the Detail template but has only the additional preceding string based fields still required.

           

          If there are a lot of fields simply create as many extra appends as you need (max allowed is 10 though so records which may have a wide range of possible lines quantities may become a problem.)

           

          I hope this makes sense - it's easier to present using an example than it is to describe in words. But it sounds like you are 85% of the way there anyway with a just few tweaks required to complete the task.

           

           

          Hope this helps.

           

           

          Grant

           

           

          Originally posted by LARRYG:

          If I have a five line detail template and set a trap on the first line, as a condition for the other lines, and a preceding string using the Advanced tab, for lines 2 - 5, will the trap on line 1 be ignored? I believe that is the case when using a preceding string trap. If so, it would be a great enhancement if it would look at both conditions when using the Advanced tab.

           

          Total for Group xxx Paid Amt:

                              Prior   :

                              Checks  :

                              Voids   :

                              Net     :

           

          Total for Group xxx Paid Amt:

                              Checks  :

                              Voids   :

                              Net     :

           

          Total for Group xxx Paid Amt:

                              Prior   :

                              Checks  :

                               

          Total for State xxx Paid Amt:

                              Prior   :

                              Checks  :

                              Voids   :

                              Net     :

           

          Trap T for Total and G for Group

          create field for Paid Amt, create field for Prior and add preceding string "Prior" as a second conditon since prior may not always appear. Same is true for lines 3 - 5. /b[/quote]

          • Preceding String
            LARRYG _

            Grant,

             

            Thank you for your reply.

             

            You wrote:

            <Preceding string is not part of the record trap <but will report the contents of the fields <where, and only where, the preceding string <exists somewhere between the trap first line for <one record and the first line for the next <trapped record, no matter how many lines that <may be except that.>

             

            First of all, there are enough lines in between records to not cause an overlap into the next record. Second, there are lines that follow a record that have the preceding string but are not

            part of a record (based on the first line trap).

             

            What I was hoping Monarch would do, is to select the fields with the preceding string if it was part of a record based on the first line trap.

             

            Don't you think it should include the record trap when selecting the fields? I hope DataWatch will add the capability of doing so in the next release.

             

            To overcome this I created a field for the first line heading and created a trap common to all group totals (including the ones I don't want)

            Then I filter the records based on the heading field. But I still believe having a preceding string condition in addition to the record trap would be cleaner and more logical.

             

            Larry

            • Preceding String
              Grant Perkins

              Larry,

               

              Sorry, I think I have misunderstood what you need to achieve and what you are suggesting as the solution.

               

              Is it that you want to be able to use the preceding string concept (or perhaps a 'Line Contains' concept?) as a sort of filter for record identification as well as for field selection?

               

              If so I have two questions for a better understanding.

               

              1. What are you using as the preceding string in that case - the code of the Group?

               

              2. What benefit would you see from pre-selecting the record by such a filter over your current 'select then filter' solution?

               

              BTW my comment re the number of lies in the sample was based on the report sample you posted just in case it was relevant to the problem. It appeared that you might only have 4 lines (including the blank) in the third record shown and that might represent a problem for the 5 line template sample. From your response it sounds like that is not a problem on the full report.

               

              Grant

               

              Originally posted by LARRYG:

              Grant,

               

              Thank you for your reply.

               

              You wrote:

              <Preceding string is not part of the record trap <but will report the contents of the fields <where, and only where, the preceding string <exists somewhere between the trap first line for <one record and the first line for the next <trapped record, no matter how many lines that <may be except that.>

               

              First of all, there are enough lines in between records to not cause an overlap into the next record. Second, there are lines that follow a record that have the preceding string but are not

              part of a record (based on the first line trap).

               

              What I was hoping Monarch would do, is to select the fields with the preceding string if it was part of a record based on the first line trap.

               

              Don't you think it should include the record trap when selecting the fields? I hope DataWatch will add the capability of doing so in the next release.

               

              To overcome this I created a field for the first line heading and created a trap common to all group totals (including the ones I don't want)

              Then I filter the records based on the heading field. But I still believe having a preceding string condition in addition to the record trap would be cleaner and more logical.

               

              Larry /b[/quote]

              • Preceding String
                LARRYG _

                Grant,

                 

                Sorry for the confusion.

                 

                I'll try to give a better example.

                 

                Throughout the report there is a block of lines I need to capture as a record - up to 5 lines - that begins as follows:

                 

                Totals for Group Paid Amt

                                 Prior Mo

                                 Checks

                                 Voids

                                 Net

                 

                All of the amount headings are in one column with the amounts in the next column.

                 

                The problem is that there are several of these blocks that start with a different heading, ie:

                 

                Totals For Divison

                Totals For State

                Totals For Dealer, etc.

                 

                I only want the block that starts with

                "Totals For Group"

                 

                Highlighting the five line block and setting a trap for T and G on the first line highlights only the five line blocks that I want throughout the report. However, lines 2 - 5 are variable. So I set a preceding string trap to capture only the fields that I want for the record block.

                 

                I want the preceding trap to be in addition to the record trap otherwise I have the following problem:

                 

                Totals For Group 10 Paid Amt  500

                                    Prior Mo  100

                                    Checks     30

                                    Voids      10

                                    Net        20

                 

                Totals For State    Paid Amt 3000

                                    Prior Mo 1000

                                    Checks     50

                                    Voids      20

                                    Net        30

                 

                Totals For Group 11 Paid Amt  450

                                    Checks    100

                 

                Totals For State    Paid Amt 1500

                                    Prior Mo  650

                                    Checks    125

                                    Voids      75

                                    Net        50

                Monarch Records:

                Group: 10

                Paid Amt: 500

                Prior Mo: 100

                Checks: 30

                Voids: 10

                Net: 20

                 

                Group: 11

                Paid Amt: 450

                Prior Mo: 650

                Checks: 100

                Voids: 75

                Net: 50

                 

                Remember, the spacing between groups is greater that what I presented above.

                 

                In summary, I want only the fields for the record that I trapped. The record trap works great as well as the preceding string trap. But the preceding string trap ignores the record block and looks beyond the record for any lines with the preceding string, which I think should be changed to include the record trap as a second condition.

                 

                Thanks for your help.

                 

                Larry

                • Preceding String
                  Grant Perkins

                  Larry,

                   

                  I see the problem more clearly now. Thanks.

                   

                  Normally I would suggest that you create a footer template and trap on T and S for example.

                   

                  On the Report screen the preceding string fields will still appear to be selected as data but they would not appear in the table and you would end up with just the two records.

                   

                  However you have several other lines that also start "Totals" something so I suspect that this idea would not fully solve your problem. Certainly not from the sample layout provided.

                   

                  If you go back to the full report, is there anything else on the Group line that makes it unique from the other total lines AND and anything about the other total lines that differentiates them from the Group line?

                   

                  For instance you have the Group number in the example line. Might numeric characters at that position make that line unique? (Probably too simple so I suspect a long shot from me!)

                   

                  Something, anything, somewhere on the line would do providing its presence or absence is unique to the group line and common to all the others. It probably need to be generic in nature - must be alpha or numeric or blank rather than looking for a specific character.

                   

                  If you can find something to define a footer trap that captured "all the others" it should effectively fix your problem.

                   

                  Does this prompt any ideas?

                   

                  If your reports are not highly confidential (or you have test samples) I would be happy to have a look at an original (via email attachment) and offer an opinion.

                   

                  I hope this help a little.

                   

                   

                  Grant

                   

                  [size="1"][ January 24, 2005, 06:27 AM: Message edited by: Grant Perkins ][/size]

                  • Preceding String
                    LARRYG _

                    Grant,

                     

                    Trapping for group number is not necessary as the trap for T and G in Totals for Group, traps all blocks that begin with that heading.

                     

                    What I need is to have the preceding string criteria to check each line 2-5 and not go beyond the 5-line block. If anyone at DataWatch reads this, I believe it would be a great enhancement if you change the way the preceding string works.

                     

                    Is there a way to create a dummy append template to stop the preceding string trap from going beyond the record trap, as I believe that would solve the problem?

                     

                    The idea of using a footer template sounds good if I could trap on something that would apply to all non Total for Group headings. I will have to look into it further. Too bad I couldn't use a trap as <>G in the G position. Another enhancement for a future release!

                     

                    Thanks.

                     

                    Larry

                    • Preceding String
                      Grant Perkins

                      Larry,

                      I hear what you are saying, though I think the  template trapping and the field Identification using preceding string are two entirely separate things as they stand and therefore you are really talking about a new trap method requirement.

                       

                      The problem about restricting the vertically floating aspect of the preceding string is that there have been a few examples on the forum where that, often in conjunction with the footer idea, was the only way to get at field in variable length records. You are fortunate to be dealing with a report that you can be sure has only 5 lines.

                       

                      So remove that feature and there is no obvious alternative approach. Whereas, even without successfully finding a way to make the footer idea work, you do have an alternative using the filter technique in your existing solution. Or at least I think that is what you said.

                       

                      My point about trapping for Group number was not really about trapping the group line. It was more about finding something that allowed all the other lines that start with "Total", EXCEPT the Group lines, to be grouped together by a common trap so that they could all become 'footer' lines and therefore act as stop points for the detail template.

                       

                      It may be that the various subtotal lines  are always segregated from the detail lines by, say, a "Totals for State" line. In which case a footer template trapped on "Totals for State" should solve the problem. It works for me using your posted sample lines and trapping on the word "State".

                       

                      If that is the case you don't need to consider anything else as far as I can see so far.

                       

                      I hope this is useful.

                       

                      Grant

                      • Preceding String
                        LARRYG _

                        Grant,

                         

                        Thank you very much for your help.

                         

                        I was suggesting an option for the advanced tab to use the preceding string for only the record block - if not checked - it would work as usual.

                         

                        The blocks that follow are variable. Sometimes there is a Dealer, Division, Region, or just State. So I could not hard-code State as a footer trap because it might select the other blocks.

                         

                        But if I can say <>G or trap on something that is common to all other blocks, then that might work. Are you saying that once Monarch finds a footer block, the Preceding String search will stop? If that's the case, then I think it will solve my problem.

                         

                        Thanks again - you've not only been more responsive, but much more helpful than Monarch's support staff! It's been over a week and I still did not receive an answer as to whether a preceding string ignores the record trap, let alone how to solve my problem.

                         

                        Regards,

                         

                        Larry

                        • Preceding String
                          Grant Perkins

                          Originally posted by LARRYG:

                          ...

                           

                          Are you saying that once Monarch finds a footer block, the Preceding String search will stop? If that's the case, then I think it will solve my problem.

                           

                          /b[/quote]Yes.

                           

                          I have just re-read my earlier posts and realised I did not explicitly say that anywhere. Sorry, I thought I had.   redface.gif[/img] 

                           

                          On the report screen when defining the template  the display may well indicate that the fields will still be selected but they will not appear in the table. Or at least that is what happens on my 7.02 version installation.

                           

                          I hope that gives you a solution.

                           

                          Grant

                          • Preceding String
                            RalphB _

                            While reading this post, I remembered a similar one from some time ago and someone came up with a unique solution to that one.  I may help here.  It took some research to find it.  Check out  [url="http://mails.datawatch.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=000258"]this[/url] post by TCorley.

                             

                            I tried it in a small sample and it seemed to work.

                             

                            Ralph

                             

                            [size="1"][ May 01, 2006, 04:53 PM: Message edited by: Todd Niemi ][/size]

                            • Preceding String
                              Dee Moore

                              I have sent the following along with Sample files:

                               

                              Hello Larry,

                               

                              Basically the problem is due to the way you are trying to use the Preceding String functionality.

                               

                              When you are using a multi-line Sample of data for which the format can be variable, the Preceding String functionality should not be used. as it states in the Help files:

                              Preceding String: Select to indicate that the first line of the field begins immediately to the right of a string, such as a label.  Enter the string in the adjacent box.  The maximum length of the string is n-1 where n is the column starting position of the field.  For example, if the field starts in column 15 you may enter a string of up to 14 characters (i.e., the entire search string must fit to the left of the field).  This option is typically used to locate the beginning of a field based upon the presence of a label to its left.

                               

                              The multi-line Sample must be fixed in order to use this functionality correctly:

                               

                              Please note, this Sample contains fixed formatted data. Labels: Paid, Prior Mo, Checks, Voided, and Net Checks are always present and located on the same line at all times.

                               

                              Totals for Group 010 Paid      500.00       

                                                   Prior Mo  100.00       

                                                   Checks        10       

                                                   Voided         2       

                                                   Net Checks     8

                              Totals for Group 011 Paid      550.00       

                                                   Prior Mo  150.00       

                                                   Checks        12       

                                                   Voided         0       

                                                   Net Checks    10

                               

                              The reason a variable line multi-line Sample cannot be used is very logical in the Sample below:

                               

                              Totals for Group 010 Paid     500.00      Preceding string: Paid

                                                   Prior Mo 100.00      Preceding string: Prior Mo

                                                   Checks       10     Preceding string: Checks

                                                   Voided        2     Preceding string: Voided

                                                   Net Checks    8     Preceding string: Net Checks

                              Totals for Group 013 Paid     450.00     Preceding string: Paid

                                                   Checks       33     Preceding string: Prior Mo

                                                   Voided        5      Preceding string: Checks

                                                   Net Checks   28     Precedingstring:Voided                                                                              Preceding string: Net Checks

                               

                              In your Model, you built the Template using a 5 line Sample. This Template only corresponds to the first Group. The second Group only has 4 lines, and, the labels used in the Advanced Tab no longer fit the criteria for the Template line in the Sample.

                               

                               

                              If you open Sample1.txt and Sample1_Recreate.mod, you will see how I recreated your process.

                               

                              Problems with this File and Model - Totals for Group 011 cancels out Totals for Group 012 because it is looking for a 5 line Sample (Group 011 only has 3 lines). Since the Template does not see the label, Prior Mo on the 2nd line, Monarch is trying to do what you are telling it to by looking to the next label location for the data regardless of the Template Trap.

                               

                              If you open Sample1.txt and ProperUse_PreString.mod, you will see the proper use of the Preceding String as well as the correct process for extracting variable length data including Calculated Fields.

                               

                              I hope you understand the above and if you have any questions, feel free to contact me.

                               

                              Regards,          

                               

                              Dee Moore

                               

                              If anyone would like the Sample files..please email me: dee_moore@datawatch.com[/email]