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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to bind the startDate for a Time Series Chart?

AllanThompson
16-Pearl

How to bind the startDate for a Time Series Chart?

Hi All,

I've added a time series chart to an AR experience and I want to only show the values from the current day.  I can do this by going to the Services for the Thing and opening up Parameters for the QueryPropertyHistory service and I can enter in the startDate as shown:

Clipboard01.png

But I want this start date to be automatically filled in.  I can see that I can create a binding to set the start date but cannot work out how to create the binding.

I've created a service for the Thing inside ThingWorx composer called Datethat will return the time at a few seconds past 12:00am on the current day as the result.  I can bind this to text in a label to verify that it's returning the correct value.  But if I try and bind it to the startDate it will not let me.  Below shows what I'm trying to do:

Clipboard02.png

I guess I"m doing something wrong here, but I"m not sure what.  Does anyone know how I can control the startDate from a binding?

Many thanks,

Allan

ACCEPTED SOLUTION

Accepted Solutions

Hi Allan,

Could you please try the following and let us know the result:

  • Delete the QueryPropertyHistory by clicking the '-' sign beside it
  • Add the QueryPropertyHistory service again by clicking the '+' sign beside Services.
  • Now, try to bind the result of Date service to the start date parameter of the QueryPropertyHistory .

Please let us know if you were able to bind those parameters after performing the above steps.

View solution in original post

5 REPLIES 5

Hi Allan,

Could you please try the following and let us know the result:

  • Delete the QueryPropertyHistory by clicking the '-' sign beside it
  • Add the QueryPropertyHistory service again by clicking the '+' sign beside Services.
  • Now, try to bind the result of Date service to the start date parameter of the QueryPropertyHistory .

Please let us know if you were able to bind those parameters after performing the above steps.

Hi Yamini,

Thanks for the prompt reply.  That fixes the problem and I can now create the binding.

Unfortunately, now that I've got the binding working, I'm seeing an issue with how the services execute in the AR.  As I mentioned, I'm trying to set the startDate to the current day, but when I load the chart, the startDate hasn't read in the value from the Date service. so it initially shows the entire history.  If I wait for the Auto-refresh (set to 30) then it will display just the current days data.  But each time I show the chart, I have to wait for the Auto-refresh to update to show the correct date.  I don't want to set the refresh rate low as it keeps redrawing the chart.

I changed the approach and generated a Property for the Thing called TodaysDate, but it also has the same problem.  I also thought that I could use an application parameter for the date and use a javascript function in the AR experience to set the value and the bind that to the startDate, but I"m not sure if this will also have the same initialization problem.

Is there any way to have the QueryProertyHistory service load after I've worked out the date?

Regards,

Allan

Hi Allan,

Glad to know that the problem got fixed!

Could you please use the ServiceInvokeComplete event which will trigger when the service call is done. You can drag this ServiceInvokeComplete event to other service to chain them together.

In your usecase, drag and drop the ServiceInvokeComplete event of date service on to the QueryPropertyHistory service.

Let us know if this helped to resolve the issue.

Brilliant.  That works perfectly.

Thanks Yamini.  Appreciate the help.

Hi Allan,

Glad I could help!

Best Regards,

Yamini

Announcements

Top Tags