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
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:
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:
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
Solved! Go to Solution.
Hi Allan,
Could you please try the following and let us know the result:
Please let us know if you were able to bind those parameters after performing the above steps.
Hi Allan,
Could you please try the following and let us know the result:
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