4 Replies Latest reply on Aug 2, 2016 2:32 PM by meghan RSS
    ssrvsub Newbie

    Anyway to apply some JS function to Value DIsplay widget?

    I know there is Expression Widget but it allows to do only simple things, so is there anyway to add function that will recive some data on input, process it, and then print it.

      • Re: Anyway to apply some JS function to Value DIsplay widget?
        carlesc Ninja

        Client side: Expression Widget and Validator Widget ( with the second you can do less things ) .

        Server side: you can build a service that does whatever you want with the data and return it back for the mashups.

        • Re: Anyway to apply some JS function to Value DIsplay widget?
          meghan Communicator

          Srvsub,

           

          You could try writing a custom service and then adding it to the Mashup.This service could contain an input and output parameter and the logic you need to use to process the input. The result could then be bound to the Value Display Widget after it's processed by this service.

           

          I'm not sure what your current Mashup looks like, but instead of binding a value directly to the Value Display Widget you would bind the value to the input parameter of this service, and then bind the output to the Value Display Widget.

           

          Meghan

            • Re: Anyway to apply some JS function to Value DIsplay widget?
              ssrvsub Newbie

              Thanks Megan, I've tried your advice and faced some problem.I attached a service(TestService) to thingTemplate with input(`rawData` - some string),output( `result` ) and logic inside. When I test it the values is ok and it works as intended. But when I try to use it in moshup input data is not passed to service.

               

              I' add GetPropertyValues service and drag a a property from Returned Data->All Data->data to  TestService's parametres `rawData` then  I drag TestService's Returned Data->All Data->result to Value Display Widget. When I run moshup widget crossed with error icon and in log i have message that my input data is `undefined`.

               

              It works if I add similar service directly to each thind and replcae input data with thing's property.

                • Re: Anyway to apply some JS function to Value DIsplay widget?
                  meghan Communicator

                  Is the GetPropertyValues service being exercised and returning property values before the TestService is exercised? I would bind the same property you are binding to the input of the TestService to a text box to make sure you are receiving the value you expect. The TestService should be exercised after the "ServiceInvokeCompleted" event of the GetPropertyValues service fires off.

                   

                  Meghan