cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Expression: Multiple parameters not supporting for custom functions

pselvaraj-1
9-Granite

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)

1 REPLY 1
PaiChung
22-Sapphire I
(To:pselvaraj-1)

This is one of those things that I still haven't figured out yet but would love to know!!!!

My one work around has been to just create a payload of a single string out of my multiple parameters and then feed that into a service that takes it apart and fires the necessary services and then returns the value ... not ideal and wish there was a better way.

Top Tags