7 Replies Latest reply: May 15, 2014 10:04 AM by Kathyski _ RSS

    Trying to use a Guru Template

    Kathyski _

      I'm a long time Monarch user who has used this forum many times in the past to solve issues I've had.  This time I have one that I just can't solve. 


      On the example below I'm trying to pull data from the line that shows INV.  My detail line is the PURGE TOTAL line.  The INV line does not show in every instance, so I'm trying to do a Guru template.  I'm setting my trap the same as my detail line and defining my fields showing in the advanced tab to pull if inv is the preceding string in the current row.  I've tried painting the entire line past the word INV and just individual fields.  In every instance when I do this, in report review it appears to be capturing the field(s), but when I go to table view the field is blank for every line.  I'm not sure what I'm doing wrong.  Can someone help me?


        TEST, IMA              79291            LOC: 9 INS CODES:9001

      246 PAY  B   21 12/12/08 522627          04/15/08       5.64-     

            PURGE TOTAL                   5.64-               5.64-     


      246 INV  S    6  05/22/08             G640063 10/23/07     153.79      

           AI  12/23/08  PENDING AUTHORIZATION                          

            PURGE TOTAL                 153.79              153.79      


      246 INV  S    1  05/08/09             H277214 05/06/09     229.02      

           C4  05/15/09  PARTIAL PAY                                    

      246 MAC  S    1 05/08/09             H277214 05/06/09      52.62-     

      246 PAY  S   21 05/15/09 544711  H277214 05/06/09     191.34-     

            PURGE TOTAL                  14.94-              14.94-     


      246 INV  S    1  07/10/09             H358339 07/08/09     319.02      

      246 MAC  S    1 07/10/09             H358339 07/08/09      67.62-     

            PURGE TOTAL                    251.40              251.40

        • Trying to use a Guru Template
          Olly Bond

          Hello kathyski,


          Do you need the INV as an append or a footer?


          If you would like to drop me an email with your model, I'd be happy to have a look. Best email address is olly@greenbar.info[/email]


          Best wishes,



            • Trying to use a Guru Template
              Kathyski _

              Thanks for agreeing to look at this.  I just emailed you the model.  It's an append template.

                • Trying to use a Guru Template
                  Olly Bond

                  Hello Kathyski,


                  I had a little play with it in v10, and preceding string seemed to behave strangely when checking in the current line. I took a two stage approach to simply exclude all the lines except PURGE and INV lines, and reverse the order, then export that as a new text file. A second model produced:


                  PURGE TOTAL 251.40 251.40     246 INV S 1 07/10/09 H358339 07/08/09 31

                  PURGE TOTAL 14.94- 14.94-     246 INV S 1 05/08/09 H277214 05/06/09 22

                  PURGE TOTAL 153.79 153.79     246 INV S 6 05/22/08 G640063 10/23/07 15

                  PURGE TOTAL 5.64- 5.64-     



                  which would be easy to clean up.


                  I'll have a look at your model, and email you back.


                  Best wishes,



                    • Trying to use a Guru Template
                      Kathyski _

                      I just emailed a sample to you.  FYI - I use version 8.02 of Monarch.  It's good to know that it's not me doing something wrong. 



                        • Trying to use a Guru Template
                          Olly Bond

                          Hello Kathy,


                          The guru template is better suited to trapping intermittent footer data that appears below some of the detail records. In your case, the data is an intermittent append data, and the most appropriate fix would be to use the "cleared by" function in Monarch v10.


                          In v10.01, I edited your append trap to trap the INV line itself, and set this to be cleared by one of your other templates (I used Purge Code Footer). Grant may have an elegant "guru" solution, but my suggestion would be to upgrade and take advantage of the new functionality!


                          Best wishes,



                            • Trying to use a Guru Template
                              Grant Perkins

                              Hi folks,


                              Based on the posted sample and the need (I assume) to report the Purge Total even if there are no INV lines (ie, this cannot be a simple filter based extraction) I doubt the Guru trap could be made reliable with certainty.


                              HOWEVER there are other approaches although whether they are valid in this case remains to be seen.


                              For example if there is only ever ONE line in a Purge Total record which may have an INV transaction category you could treat the entire line group as a detail record (assuming a suitable trap can be identified). Include the Purge Total line in that.


                              Now create a calculated field using the TEXTLINE() function to seek out the INV line. If any INV line which may exist is always line 1 you can specify that text line looks for INV in line one and populate the Calculated field according to whether it is true or false.


                              If the INV line can appear in any line then use TEXTLINE() in its SEARCH mode when it will return the first line it finds with INV (or whatever your search is) in the block of text. (If INV might appear in other circumstances you may need to include space either side,  " INV " , for the search to work. It's not guaranteed to work simply at all times being field content dependent!


                              You should then be able to get a ull list of all Purge Total details lines with a flag/Data content for an associated INV line. Use slice and dice techniques to split the lines up into the constituent fields required. (The Purge Total values might be part of the detail record or treated as a Footer in this situation  - either will probably work fine from what I can tell so far.)


                              How close this idea gets to a solution for the report in question I don't know. I works on the sample poted EXCEPT that to obtain the block of lines I needed to identify a unique trap to start the block and the only thing available is the blank line between each record. Trapping a blank line and then defining a multi-row field is OK but starts to get messy if there are other spurious blank lines in the report that cannot be 'lost' in some way or, as in this case, the first record (or others) do not have blank lines ahead of them. A more specific trap would be preferable if it can be identified.


                              I'm not sure whether this moves things forward but it should only take a couple of minutes to assess whether this idea is a dead end.