0 Replies Latest reply on Dec 7, 2016 6:19 AM by mvolanti RSS
    mvolanti Apprentice

    Unable to binding array value from service in subscription

    Hi,

     

    I did a subscription with a code that transcoding the HEX string to pass values to the proprieties of a thing.

     

    So I wrote a function(javascript) in the subscription that I can call many times. This worked fine.

     

     

    var result = MYFUNCTION(me.SystemStatus,me.WarningFlags);                  the result is like this:  result = [value(BOOL),  [array](BOOL)  ]

     

     

        //------------Binding propriety Status_RUN-------------------//

     

        me.Status_RUN = result[0];              //BOOLEAN

     

      //------------Binding proprieties WaringFlags-------------------//

     

          me.Hopper_1_Backup =  result[1][0];        //BOOLEAN

          me.Hopper_1_Empty =    result[1][4];        //BOOLEAN

         me.Hopper_1_full =          result[1][10];       //BOOLEAN

          me.Sd_card_full =            result[1][16];      //BOOLEAN



    This worked fine.




    I have this issue:


    FOR GREATER CONTROL, I wrote the MYFUCNTION in one service called STATE.

     

     




    SERVICE:


    ...........

      return [Status_RUN,Werror];

    }

     

    //binging

     

    var result = MYFUNCTION(me.SystemStatus,me.WarningFlags);

                                         

    2.png


     

    SUBSCRIPTION:

     

    I called the service:

     

    ....

    var result = me.STATE();   

     

    then I bound propreties:


        //------------Binding propriety Status_RUN-------------------//

     

        me.Status_RUN = result[0];              //BOOLEAN

     

      //------------Binding proprieties WaringFlags-------------------//

     

          me.Hopper_1_Backup =    result[1][0];        //BOOLEAN

          me.Hopper_1_Empty =      result[1][4];        //BOOLEAN

          me.Hopper_1_full =          result[1][10];      //BOOLEAN

          me.Sd_card_full =            result[1][16];      //BOOLEAN

     

     

     

    Doesn't work, the values of the proprieties doesn't chage!!!



    CAN YOU HELP ME???




    Thanks