• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Excel post process script error

    User help
    3
    14
    2.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MattFoxM
      MattFox
      last edited by MattFox

      That error there looks like it's saying that method does not exist...
      Can you show some more code and explain what you're trying to achieve?
      EDIT:
      Looked in the public source, setString(key,value) is the closest thing I can find.
      core/src/com/serotonin/util/properties/MutableProperties.java
      Perhaps @phildunlap can bring some more light to the situation.

      Do not follow where the path may lead; go instead where there is no path.
      And leave a trail - Muriel Strode

      1 Reply Last reply Reply Quote 0
      • P
        psysak
        last edited by psysak

        These are the functions which are supposed to exist in the post process script engine, setString being one of them.

        String getString(int sheet, int column, int row) - get a String representation of the value of the cell
        String getString(String sheetName, int column, int row) - get a String representation of the value of the cell
        void setString(int sheet, int column, int row, String value) - set a cell to string type and with a string value
        void setString(String sheet, int column, int row, String value) - set a cell to string type and with a string value
        void setNumeric(int sheet, int column, int row, double value) - set a cell to numeric type and with a double value
        void setNumeric(String sheet, int column, int row, double value) - set a cell to numeric type and with a double value
        void setDate(int sheet, int column, int row, long value) - set a cell to date type and with a long value
        void setDate(String sheet, int column, int row, long value) - set a cell to date type and with a long value
        void openNamedRange(String namedRange, boolean append) - open a named range, optionally begin at its last cell
        void writeStringToNamedRange(String namedRange, value) - write a string value into the next cell of the named range
        void writeNumericToNamedRange(String namedRange, value) - write a numeric value into the next cell of the named range
        
        1 Reply Last reply Reply Quote 0
        • MattFoxM
          MattFox
          last edited by

          @psysak said in Excel post process script error:

          ReferenceError: "setString" is not defined in <eval> at line number 16 in <eval> at line number 16

          Sorry psysak, I'm not much help here. I can't find the code in github to see what should be happening. See if you can log your variables and ensure that you're inside a post process instance, that's the only way I can think of telling that you have inherited those set{dataType} methods.

          Fox

          Do not follow where the path may lead; go instead where there is no path.
          And leave a trail - Muriel Strode

          1 Reply Last reply Reply Quote 0
          • P
            psysak
            last edited by

            No problem. I wonder if I'm invoking them wrong somehow but the documentation doesn't state anything specific. They're supposed to be part of ExcelReportUtility

            The ExcelReportUtility is available in the post processing script of an Excel report. It enables one to read or write values to cells, and to write values into named ranges. One can "print(ExcelReportUtility);" from the post processing script entry to see a list of functions available. They are,
            
            String getString(int sheet, int column, int row) - get a String representation of the value of the cell
            String getString(String sheetName, int column, int row) - get a String representation of the value of the cell
            void setString(int sheet, int column, int row, String value) - set a cell to string type and with a string value
            void setString(String sheet, int column, int row, String value) - set a cell to string type and with a string value
            void setNumeric(int sheet, int column, int row, double value) - set a cell to numeric type and with a double value
            void setNumeric(String sheet, int column, int row, double value) - set a cell to numeric type and with a double value
            void setDate(int sheet, int column, int row, long value) - set a cell to date type and with a long value
            void setDate(String sheet, int column, int row, long value) - set a cell to date type and with a long value
            void openNamedRange(String namedRange, boolean append) - open a named range, optionally begin at its last cell
            void writeStringToNamedRange(String namedRange, value) - write a string value into the next cell of the named range
            void writeNumericToNamedRange(String namedRange, value) - write a numeric value into the next cell of the named range
            
            MattFoxM 1 Reply Last reply Reply Quote 0
            • MattFoxM
              MattFox @psysak
              last edited by

              @psysak
              try
              ExcelReportUtility.setString(sheet,column,.row,"string")

              or create a var that hosts the ExcelReportUtility?

              var ERU = new ExcelReportUtility()
              ERU.setString(sheetNum,col,row,string);
              

              Do not follow where the path may lead; go instead where there is no path.
              And leave a trail - Muriel Strode

              1 Reply Last reply Reply Quote 0
              • P
                psysak
                last edited by

                Exactly what I just went off and tried and... it works :) Thanks @MattFox

                1 Reply Last reply Reply Quote 0
                • MattFoxM
                  MattFox
                  last edited by

                  Anytime!
                  :D

                  Do not follow where the path may lead; go instead where there is no path.
                  And leave a trail - Muriel Strode

                  1 Reply Last reply Reply Quote 1
                  • phildunlapP
                    phildunlap
                    last edited by

                    Thanks Fox!

                    To clarify,

                    ExcelReportUtility.setString(sheet,column,row,"string")

                    is the correct syntax. I don't think the instantiation of a new ExcelReportUtility() would work.

                    1 Reply Last reply Reply Quote 0
                    • P
                      psysak
                      last edited by

                      @phildunlap maybe this isn't the thread to ask this but it comes up in this context for me. Could you please explain a little bit about DataPointRT to me? CONTEXT_POINTS returns a DataPointRT object with an id and a name. I notice that I can get the ID just by referencing the property directly with .id, however .name is not a thing. How come and how would I get it?

                      1 Reply Last reply Reply Quote 0
                      • phildunlapP
                        phildunlap
                        last edited by

                        You can see the functions in the class, and why it prints the string it does: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/serotonin/m2m2/rt/dataImage/DataPointRT.java#L757

                        So you would have to go through the .getVO() function to get the DataPointVO, which has a .name

                        1 Reply Last reply Reply Quote 0
                        • P
                          psysak
                          last edited by

                          Ooooh ok, thanks Phil

                          1 Reply Last reply Reply Quote 0
                          • P
                            psysak
                            last edited by

                            You guys don't have some kind of visual representation for how all these things link together do you? I'm not a full time developer so it's really difficult to understand how all these little things bind to each other and why.

                            1 Reply Last reply Reply Quote 0
                            • phildunlapP
                              phildunlap
                              last edited by

                              No such eureka! picture exists. If you clone the code into an IDE you can at least view the definition of one or another function with a hotkey like F3, which can let you scoot around the code faster.

                              Generally scripts were intended to get something like the name or other DataPointVO information via the DataPointWrapper in the script documentation, like, p.getDataPointWrapper().getName();

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post