Skip to main content
10-Marble
April 13, 2017
Question

How can I add "Automatic update when values available" service in my custom service?

  • April 13, 2017
  • 7 replies
  • 3197 views

Dear Team,

I need to enable  Automatic update when values available in custom service. So how can I achieve this  functionality?

    7 replies

    22-Sapphire I
    April 13, 2017

    Can you explain this a little better please?

    What does your model look like, what is your service, what needs to be updated?

    bgupta-210-MarbleAuthor
    10-Marble
    April 14, 2017

    Hi,

    I need to auto update my time series chart. For this I am using Auto refresh widget. But  I don't want to sue this AutoRefresh widget.  Such refresh option are available in GetProperties [Automatic update when values available] without using AutoRefresh widget.

    In order to render data on my time series following  code has written. So How can I add  [Automatic update when values available] features in mu custom service in order to  avoid AutoRefresh widget?

    My service code:

    var query2 = {

      "filters": {

        "fieldName": "source",

        "type": "EQ",

        "value": filter

      }

    };

    var params = {

       

        oldestFirst: undefined /* BOOLEAN */,

      maxItems: undefined /* NUMBER */,

      sourceTags: undefined /* TAGS */,

      endDate: undefined /* DATETIME */,

      query:  query2 /* QUERY */,

      source: undefined/* STRING */,

      startDate: undefined /* DATETIME */,

      tags: undefined /* TAGS */

       

    };

    // result: INFOTABLE

    var result = Things["PumpValueStream"].QueryStreamEntriesWithData(params);

    Data binding  on mashups

    5-Regular Member
    April 17, 2017

    Hi Bhuwaneshwar Gupta

    Automatically update values when able is currently available only for GetProperties service.

    As a workaround; you can try to call your custom Service on ServiceInvokeCompleted of GetProperties service.

    I hope it helps.

    bgupta-210-MarbleAuthor
    10-Marble
    April 17, 2017

    Thanks. But this workaround not working.

    5-Regular Member
    April 18, 2017

    Hi Bhuwaneshwar Gupta​,

    Please do following:

    1. Find all the Properties in your Thing for which the DataChange should trigger the custom service.

    2. In mashup; add value display widget (or some other widgets) for each property in Step1.

    3. Bind the properties from GetProperties service to these widget.

    4. Set visible property of these widgets to false so that they don't show up at the RunTime.

    5. Now bind the ServiceInvokeCompleted of GetProperties Service to your custom Service.

    6. Save and view Mashup.

    Result: When any of the Property from Step1 is changed; Custom Service will be called.