Announcement

Collapse
No announcement yet.

clear statistics every day morning

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • clear statistics every day morning

    Hi,
    How to clear statistics on dashboard very day morning without doing it manually.


    Thanks.

  • #2
    You can create a JavaScript Reader that polls every day at a specific time, then call ChannelUtil to reset the stats for a particular channel.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      I need to clear statistics for all the channels.

      Comment


      • #4
        Originally posted by nreddy View Post
        I need to clear statistics for all the channels.
        Then you can do the same thing, for every channel. There's not yet anything in ChannelUtil to iterate through all channels, but you could potentially call out to an internal controller to do that. There are examples of how to do that on these forums.
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment


        • #5
          can anyone post sample javascript to clear statistics very day

          hi,
          can anyone post sample javascript to clear statistics very day.


          Thanks.

          Comment


          • #6
            version:-3.1.1.6456
            I am using the following code in the channel destination:

            var outsams = '231752b8-b129-4b8e-910e-ff0975afbf48';
            var cstate = ChannelUtil.getChannelState(outsams).toString();
            ChannelUtil.clearStatistics(outsams);

            but iam getting the following error.

            please help me with this, am i using the functions properly, if not please correct me.



            [2015-02-09 12:40:57,787] ERROR (com.mirth.connect.connectors.js.JavaScriptDispatc her:175): Error evaluating JavaScript Writer (JavaScript Writer "reset channel stats" on channel 0e9350ae-5be1-4af3-8c06-aec1ccee5d6d).
            com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
            reset channel statsCONNECTOR:
            reset channel statsSCRIPT SOURCE:
            JavaScript WriterSOURCE CODE:
            519: }520: }521: function doScript() {522: var outsams = '231752b8-b129-4b8e-910e-ff0975afbf48';523: var cstate = ChannelUtil.getChannelState(outsams).toString();52 4: ChannelUtil.clearStatistics(outsams);525: 526: 527: 528: LINE NUMBER:
            524DETAILS:
            Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "clearStatistics".
            at de8f1bb1-7ed8-4846-99fb-3f913c306c6e:524 (doScript)
            at de8f1bb1-7ed8-4846-99fb-3f913c306c6e:533
            at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.call(JavaScriptDispatc her.java:166)
            at com.mirth.connect.connectors.js.JavaScriptDispatch er$JavaScriptDispatcherTask.call(JavaScriptDispatc her.java:105)
            at java.util.concurrent.FutureTask.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
            at java.lang.Thread.run(Unknown Source)

            Comment


            • #7
              It is resetStatistics. This may help, it is towards the bottom....


              http://www.mirthcorp.com/community/f...il.java?r=7528

              Comment


              • #8
                Also, use the User API. There's a link to it in the right-click context menu in code editors. There's even a link to it always visible in the Other section of the left-hand task pane. We also host it publicly: http://javadocs.mirthcorp.com/connect/3.1.1/user-api/

                ChannelUtil.resetStatistics(channelIdOrName)
                Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

                Nicholas Rupley
                Work: 949-237-6069
                Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


                - How do I foo?
                - You just bar.

                Comment


                • #9
                  Hi i am using channelutil class in version 3.0.0.6931 and i am getting folling error.

                  [2015-02-23 08:17:18,407] ERROR (com.mirth.connect.connectors.js.JavaScriptReceive r:90): Error executing JavaScript Reader script a18568ea-e1b5-44ea-bb17-195d0acd6c0f.
                  com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
                  clearCONNECTOR:
                  SourceSOURCE CODE:
                  520: //statsController.decrementReceivedCount('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');521: 522: 523: //ChannelUtil.clearStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa')524: 525: ChannelUtil.resetStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');526: return; 527: }LINE NUMBER:
                  525DETAILS:
                  Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "resetStatistics".
                  at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:525 (doScript)
                  at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:528
                  at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:62)
                  at com.mirth.connect.connectors.js.JavaScriptReceiver .poll(JavaScriptReceiver.java:88)
                  at com.mirth.connect.donkey.server.channel.PollConnec tor$PollConnectorTask.run(PollConnector.java:125)
                  at java.util.TimerThread.mainLoop(Unknown Source)
                  at java.util.TimerThread.run(Unknown Source)Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
                  clearCONNECTOR:
                  SourceSOURCE CODE:
                  520: //statsController.decrementReceivedCount('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');521: 522: 523: //ChannelUtil.clearStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa')524: 525: ChannelUtil.resetStatistics('5ab183a8-3b57-49ba-a3e8-3ae82ffcd3aa');526: return; 527: }LINE NUMBER:
                  525DETAILS:
                  Java class "com.mirth.connect.server.userutil.ChannelUtil " has no public instance field or method named "resetStatistics".
                  at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:525 (doScript)
                  at a18568ea-e1b5-44ea-bb17-195d0acd6c0f:528
                  at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:490)
                  at com.mirth.connect.connectors.js.JavaScriptReceiver $JavaScriptReceiverTask.call(JavaScriptReceiver.ja va:113)
                  at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
                  at java.util.concurrent.FutureTask.run(Unknown Source)
                  at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
                  at java.lang.Thread.run(Unknown Source)

                  Comment


                  • #10
                    The reset statistics methods were added in 3.1.
                    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

                    Nicholas Rupley
                    Work: 949-237-6069
                    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


                    - How do I foo?
                    - You just bar.

                    Comment


                    • #11
                      Originally posted by narupley View Post
                      The reset statistics methods were added in 3.1.
                      ok thanks, then what methed should i use in version 3.0.0.6931 to clear the statistics?
                      Last edited by nreddy; 02-23-2015, 06:26 AM.

                      Comment


                      • #12
                        ok thanks, then what methed should i use in version 3.0.0.6931 to clear the statistics?
                        In version 3.0.0 there is no supported method of clearing the message statistics in javascript. You would have to access the Mirth Connect internals, but that is unsupported and not recommended. The best thing to do is upgrade to the latest version of Mirth Connect.

                        Comment


                        • #13
                          Thanks Brentm for information.
                          But tried to update the mirth database.
                          version :3.0.0.6931
                          database: sql 2008 r2
                          I am trying to clear the dashboard statistics. so i created one channel, in which destination is database writer. i am querying the database with update query
                          UPDATE [D_MS10] SET RECEIVED = 0, FILTERED = 0, SENT = 0, ERROR = 0;

                          query is executing fine and the table is also updating with zeros but the statistics values on dashboard are not changing.

                          am i missing something?


                          Thanks.

                          Comment


                          • #14
                            query is executing fine and the table is also updating with zeros but the statistics values on dashboard are not changing.

                            am i missing something?
                            The statistics are cached in the server's memory, so updating them in the database will only take effect after restarting the Mirth Connect server.

                            Comment


                            • #15
                              So is there a way to clear the statistics in version :3.0.0.6931 ?

                              Comment

                              Working...
                              X