2 Replies Latest reply: May 15, 2014 9:59 AM by Nick Osdale-Popa RSS

    help with variable length Fields

    Nupur _

      Hello all,

      I want Monarch to stop a trap when it sees a particular string. Since that option wasn't available, I am stuck.

      As shown, each field below is preceded by its field name. Each new record starts with ">>>". So I made a template for all 15 lines of the first record and used a floating trap for the first line. The problem I'm facing is that sometimes the trap I've made for each field is picking up characters from the next field.

      E.g., I made a trap for Surgeon using the first record using the field length of the Surgeon entry. However, when it sees Surgeon in record 3, it's picking up characters from "Ref" from "Referring Physician" string because there's a slight horizontal shift.

       

      It would be really great if I could use floating trap for all the lines individually, but I'm getting extra records in the Table view because there is some inconsistency in the data.

       

      Any help would be greatly appreciated.

       

      Thank you.

      Nupur

       

      [font="courier"]  >>> xxxxx, xxxxxx      IxxxxxxxxxxyydddddS

      1

                             xxxxxxx xxxxxxxxxxx xxxxxxxx

                          xx xx xxxxx xx. xxxxxxx, xx ddddd

      Path#: yyddddd  -S     SURGICAL PATHOLOGY REPORT       Date Received: yymmdd

       

      Name: xxxxx, xxxxxx      I      UMR#: xxxxxxxxxx       ACCT: xxxxxxxxxx

       

      Surgeon: xxxxx, E.               Referring Physician: xxxxxxxx, C.

       

      Location: 010903      Age : 62            DOB : yymmdd           Sex : F

       

      Specimen      : UTERUS, BILATERAL FALLOPIAN TUBES AND OVARIES; APPENDIX.

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

      Date Reported: 1-18-yy Report By x. y. xxxxxxxx, M. D.

       

      >>> xxxxxxxx, xxxxx       LddddddddddyydddddS

      1

                             xxxxxxx xxxxxxxxxxx xxxxxxxx

                          50 N. PERRY ST. PONTIAC, MI 48342

      Path#: yyddddd  -S     SURGICAL PATHOLOGY REPORT       Date Received: 93mmdd

       

      Name: xxxxxxxx, xxxxx       L   UMR#: xxxxxxxxxx       ACCT: xxxxxxxxxx

       

      Surgeon: xxxxxx, C.L.            Referring Physician: xxxxx M

       

      Location: O           Age : 30            DOB : yymmdd           Sex : F

       

      Specimen      : COLON BIOPSY 35CM

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

      Date Reported: yy0506  Report By x.y. xxx D.O.

       

      >>> xxxxxxxx, xxxxxx      FxxxxxxxxxxyydddddS

      1

                             xxxxxxx xxxxxxxxxxx xxxxxxxx

                          xx xx xxxxx xx. xxxxxxx, xx 12345

      Path#: yyddddd  -S     SURGICAL PATHOLOGY REPORT       Date Received: yymmdd

       

      Name: xxxxxxxx, xxxxxx      F   UMR#: xxxxxxxxxx       ACCT: xxxxxxxxxx

       

      Surgeon: xxxxxxx P          Referring Physician: xxxxxxx NB

       

      Location: CC0601      Age : 87            DOB : yymmdd           Sex : F

       

      Specimen      : BIOPSY OF TUMOR FOR FROZEN SECTION

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

      Date Reported: 1-12-yy Report By x.y. xxx D.O.

      /font[/quote]

        • help with variable length Fields
          Greg_Goodman _

          Monarch can be so much fun because there can be a bunch of ways to work around issues.

           

          One way to get around the variable position of 'Referring Phys' text is to trap the entire line and split it into calculated fields by determining the position of "Referring Phys" using instr function. Once you know that position, using substr function to extract the values you need should be pretty easy since the length of each of the 2 labels is fixed

          • help with variable length Fields
            Nick Osdale-Popa

            Not sure which version of Monarch you are using and I don't recall which version added this function, but you can follow the same idea that Greg suggested, but use the Extract Function (I'm using v8.01Pro):

             

            To get the Surgeon Name use:

            Extract(,"Surgeon: ","Referring")[/b]

             

            To get the Physician Name Use:

            Extract( + "]","Physician: ","]")[/b]

             

            A "]" is appended to the end of the field to give the Extract() command an ending character string.

             

            This command has helped me tremendously and, IMO, much more convenient than using the InStr() function.

             

             

            For Datawatch: Is there a quick reference of what functions are available in each version of Monarch ? There's a handy reference in the Programmer's Guide that indicate properties/methods available to each Monarch version, why not the functions?