1 Reply Latest reply on Dec 6, 2017 8:32 AM by pchung RSS
    pselvaraj-2 Explorer

    Expression: Multiple parameters not supporting for custom functions

    Using "Expressions" we are adding additional columns with values to the result datashape. For few columns we had to call services from other things which has multiple parameters but expressions is supporting only single parameters. Pl assist how to call services which has multiple parameters. Or, any other alternate approach is available?

     

    var additionalColumnNames = "readingDate,readingYear,readingHour,readingMinutes,readingDay,readingDayName,dayType,readingWeek,readingWeekName,readingMonth,readingMonthName,readingFullDate,readingFullDateWithHour";

        var additionalColumnTypes = "NUMBER,NUMBER,NUMBER,NUMBER,NUMBER,STRING,STRING,NUMBER,STRING,NUMBER,STRING,STRING,DATETIME";

     

     

      var params = {

            types: additionalColumnTypes /* STRING */,

            t: finalEnergyMeterList /* INFOTABLE */,

            columns: additionalColumnNames /* STRING */,

            expressions: "((readingTime != undefined) ? readingTime.getDate(): 0 )" + "," +

            "((readingTime != undefined) ? readingTime.getFullYear(): 0 )" + "," +

            "((readingTime != undefined) ? readingTime.getHours() : 0)" + "," + 

            "((readingTime != undefined) ? readingTime.getMinutes(): 0 )" + "," +

            "((readingTime != undefined) ? dateDayOfWeek(readingTime) : 0 )" + "," +

            "((readingTime != undefined) ? Things['Solution.CommonServices'].GetDayNameByDate({readingDate:readingTime}) : '')" + "," +

            "((readingTime != undefined) ? Things['Solution.CommonServices'].GetDayTypeByDate({readingDate:readingTime}) : '')" + "," +

                        "((readingTime != undefined) ? Things['Solution.CommonServices'].GetWeekOfCurrentMonth({inputDate:readingTime}) : 0)"  + "," +

      "((readingTime != undefined) ? 'W' + Things['Solution.CommonServices'].GetWeekOfCurrentMonth({inputDate:readingTime}) : '')"  + "," +

            "((readingTime != undefined) ? readingTime.getMonth() +1 : 0)"  + "," +

            "((readingTime != undefined) ? Things['Solution.CommonServices'].GetMonthNameByDate({readingDate:readingTime}) : '')" + "," +

            "((readingTime != undefined) ? Things['Solution.CommonServices'].GetReadingFullDate({readingDate:readingTime}) : '')" + "," +

            "((readingTime != undefined) ? Things['Solution.CommonServices'].GetReadingFullDateWithHour({readingDate:readingTime}) : undefined)"

          };

     

        var result = Resources["InfoTableFunctions"].DeriveFields(params)