Monarch question

Posted on 2006-05-17
Last Modified: 2012-06-27
I'm not sure if I am in the right area, but I have a question regarding the Monarch software.

Is it possible to extract lines from a report based on what the previous line has in it?

For example, I wish to extract only those lines that have the 1st 5 characters as "TOTAL", but the line above it must either be blank or have an underscore (_).  Is this possible?

Question by:mak345
    LVL 35

    Expert Comment


    While monarch does allow you to use multi-line templates, it doesn't allow you to specify the trap on both of the lines.  What I've done in similar situations is use one trap on both lines (or in your case, two traps on both lines, one for _ and one for blank), make sure "Trap line" is 1, getting what you need from line 2.  Then use an append trap for just line two when TOTAL appears, and only use the data where the values match from both traps (though for you it would be if _ and TOTAL values match, and blank and TOTAL values match).

    Extracting some of that data would be possible with a handwritten program (not monarch), though it may not be worth the trouble of creating it, when you can use the workaround above.

    To show you what I mean, I'll assume you want the 3 characters after TOTAL.  For my example I'll say the trap name for the 3 characters after total on the line after a blank line is VAR1, the trap name for the 3 characters after a _ line is VAR2, and the trap name for the 3 characters after TOTAL is VAR3. So if a portion of your file looked like:





    Your table (using | as the column separator) would look something like
    VAR1  |  VAR2  |  VAR3
    123    |            |  123
    234    |            |
             |  345     |   345
             |  RAN    |
    456    |            |  456

    You would only want cases where VAR1=VAR3 or VAR2=VAR3, which would be lines 1, 3, 5.  All 5 lines would have to be exported, and in the exported file (probably excel or csv for the first pass) you would have to delete the lines when they dont match.

    Again, not an easy solution, but monarch didn't make this situation easy to deal with.

    Author Comment

    From above:

    make sure "Trap line" is 1, getting what you need from line 2.

    How do I go about doing that?
    LVL 35

    Expert Comment

    Open the file in monarch, and view the Report (ie not table or summary).  Highlight the 2 lines that can contain the pattern, and go to Template / New Template.
    There is a setting called "Trap Line" (to the right of Ok / Cancel), make sure that is listed as 1.
    In the line where you define the trap (Has an underlined "R" to the left of it), put an underscore in the location yours is in on line 1.  In the box below it (has an underlined "S"), highlight the portion on the second line that you want to take.  Right-click it, add the name, and click ok (normal trap/pattern defining procedure).  
    This way it will look on both lines, and only take the part of the second line when line 1 has the underscore.

    Make sense?

    Author Comment

    When I do this, it highlights anything with an underscore and the characters below it.  However, I want anything with an underscore & only those lines that have "TOTAL" below it.  Possible?
    LVL 35

    Accepted Solution

    Not in one trap.  You'll have to use 2 templates, one for the underscore and another for the total, and when the 2 values are the same then you know it met both criteria.  Unfortunately it is the only way to do it in monarch, since it doesnt allow you to use multi-line patterns (ie underscore on line one and total on line two). It might be possible you can do it in the newest version which I haven't used, but when I looked on their website and related forums, I saw nothing that suggested it is possible yet.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
    Video by: Tony
    This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
    The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now