Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi,
I have a few questions I'm hoping to get some help with:
2. How would I pass values to a contained mashup that is dynamically bound?
Thanks.
Hi,
I'm still having trouble with these two questions. Are these possible to perform within ThingWorx?
Any help would be appreciated. Thanks.
Victor,
Hi Adam,
Thanks, that worked for setting up parameters on a dynamically bound mashup.
For the stream, I want to set up a stream that queries and records values in a database at a set interval. In essence, if a database is not historizing the data points, be able to perform the historization within Thingworx. If there are other alternatives to the stream, please let me know.
While a database that historizes data would be preferable, it is certainly possible to do what you've described using a Stream. You can use a Timer-based Thing or Scheduler-based Thing to schedule an Event to fire at a particular interval and create a Subscription to the Event.
Hi Adam,
Still trying to wrap my head around it. I've created a stream (TestDBStream) and have associated a data shape to it (TestDBShape), which contains all my field definitions that I want. I have also created a timer (TestDBTimer), keeping the defaults and configuration rate of 60 seconds.
Where I am stuck is at the event/subscription. Were you saying I can create an event/subscription on the Timer or should this be done on my database thing? In any case, I attempted to create an event (TestDBRetrieveValues) on the timer and was in the process of adding a subscription to fire the event (TestDBRetrieveValues), but I'm not sure what else needs to be done.
Looking at the subscription on the timer, I feel the source should be my database thing and I was looking at the "Add Stream Entry" script, but not sure if I was going down the right path or what needed to be configured to have the timer retrieve values from the database and store it into the stream.
Any help would be appreciated. Thanks.
Victor,
Hi Adam,
Thanks for the guidance. I have a better understanding conceptually. I've created a subscription on the stream to have the source be the TestDBTimer. I understand that when the timer hits the interval, it should trigger my service on the stream.
The service I am to create on the Stream to retrieve the values from the database, do you have a tutorial on the configuration parameters or what snippets I am to use? I created a service and went to the Entities tab to find my Database Thing and added a service from it. So it added a snippet: var result = Things["TestConnectSQL"].RetrieveTestInfoData(); Testing it throws an error of invalid service name.
And within my Timer Subscription on the stream, how do I configure the snippet to call my service on the stream? I went to the Me tab and added in the service I created, which added in a snippet: var result = me.TestDBRetrieveService();
Sorry for all the questions, new to this and trying to test out the capabilities.
Victor,
Hi Adam,
Thanks for the info, I'll look into doing what you mentioned and let you know.
Thanks!
Hi Adam,
The stream is working now and picking up data. Thanks again for all your help!
Hi Adam,
I have followed the steps mentioned by you.
TestDBTimer has it's own
Event
, Timer, which fires at the interval you set in the Configuration section. You'll want to create aSubscription
to thisEvent
. Since you'll be storing this data in aStream
, I would create aSubscription
to the Timer'sEvent
on theStream
anda
Services
on theStream
(which you'll call from theSubscription
) to retrieve values from the database and add aStream
entry.What is Add a Stream entry..?
How do I check the values in the stream?
When I call the Generic service "GetStreamData" of Stream Thing, I get only the coloumn names and not the data.Please help.
Hi Raj,
Hi Adam,
Thanks for the comments. I have followed the below steps and still data is not picked up in stream.
I am expecting to receive the data from DB and to be added to stream. But the data from DB is not picked up in the stream.
Note: RetrieveTestInfoData() is working properly and returning a row of DB data.
What does your actual code snippet look like that Adds the data to the Stream (besides the retrieval of your data)?
Hi Adam & PaiC,
Thanks for pointing out. The stream is working now and picking up data. I want to remove all the entries in the Stream but only "DeleteStreamEntry" service is available. I am able to delete only one entry corresponding to streamEntryID.kindly let me know to remove all entries in the stream.
That can be done with PurgeStreamEntries. You will be asked for the time interval from which all entries will be removed.