4 Replies Latest reply: May 15, 2014 9:58 AM by Mike Urbonas RSS

    flags

    njones _

      Hello All

       

      Is there a way to set a flag in monarch & then base the value of calculated fields based on this ?

       

      The problem I am trying to solve is to replace the first occurence of text 'abc' with 'def', and the second and subsequent occurences with 'ghi'.  At the moment, this has me stumped & I suspect I may be hitting a brick wall.

       

      many thanks

        • flags
          Grant Perkins

          Hello njones,

           

          Sound like an interesting problem. A couple of questions.

           

          Which version of Monarch do you have? (Just to be sure we are looking for a solution using tools which will be at your disposal).

           

          Is the text in a text block or is it more in the form of records and, either way, is it possible to identify the first occurence of the text as a different type of entry. For example find the text in the detail records but have the first occurence as an Append - or something along those lines? Would the report (assuming it is a report) format help - first occurence always on a specific page line for example.

           

          It looks like the key to the problem is being able to clearly identify the first occurence. The subsequent substitutions should be possible and I would imagine you have already worked out how to do that.

           

          Regards,

           

          Grant

           

          Originally posted by njones:

          Hello All

           

          Is there a way to set a flag in monarch & then base the value of calculated fields based on this ?

           

          The problem I am trying to solve is to replace the first occurence of text 'abc' with 'def', and the second and subsequent occurences with 'ghi'.  At the moment, this has me stumped & I suspect I may be hitting a brick wall.

           

          many thanks /b[/quote]

          • flags
            njones _

            I have monarch 6.01.  I am trying to process an edi data file rather than a report type of file.  To make the problem more complex there may be a number of instances of 'def' in the file, each of which need changing to a different value.  (I could fix the problem with the unix 'sed' editor bbut prefer not to at the moment)

             

            thanks for your thought so far ...

            • flags
              Grant Perkins

              V6 is good, provides a few more options. Pro version I hope?

               

              If 6 Pro are you reading the file in as a database or mapping it as a report?

               

              How would you use sed to make the changes (multi-pass concept?) and can that be replicated in Monarch functions?

               

              Any chance of a an example and sample format that could be played with? (Sensitive data edited out of course.) From a personal point of view I always find it easier to seek a solution if I can visually see the problem and any consequential factors.

               

              Grant

               

              Originally posted by njones:

              I have monarch 6.01.  I am trying to process an edi data file rather than a report type of file.  To make the problem more complex there may be a number of instances of 'def' in the file, each of which need changing to a different value.  (I could fix the problem with the unix 'sed' editor bbut prefer not to at the moment)

               

              thanks for your thought so far ... /b[/quote]

              • flags
                Mike Urbonas

                Originally posted by njones:

                Hello All

                 

                Is there a way to set a flag in monarch & then base the value of calculated fields based on this ?

                 

                The problem I am trying to solve is to replace the first occurence of text 'abc' with 'def', and the second and subsequent occurences with 'ghi'.  At the moment, this has me stumped & I suspect I may be hitting a brick wall.

                 

                many thanks /b[/quote]Hi

                 

                Begin by doing a filter in your Monarch table such as text="abc" -- then this idea will work:

                 

                (1) Create a calc field consisting simply of: Rowno()

                (2) Create a 2nd calc field as follows (assume the field with text in question is called "text"):

                IF(rowno()=1,"def","ghi")

                 

                If doing a filter on your Monarch table presents a problem in terms of your overall project, let me know

                 

                Mike Urbonas

                Product Marketing Manager

                Datawatch Corporation