Skip to main content
Question

What can I use to store current and past readings from an http link?


I have a link which gives me rain gauge sensor information. Everytime I refresh the link I get new readings, however I want to set up my workbench to keep the current readings in one table and it to store previous readings in a history table. This is what I have set up, however I don't know what to use to log previous readings. The current and history keep updating with the same current values.

4 replies

david_r
Celebrity
  • August 28, 2018

If this was a proper SQL database you're writing to, my recommendation would be to write everything to a single table and then define a view that always returns the most recent readings.

Either way, you'll have to define what "current" means in this context. If it's just the latest recording, you can use a Sorter (by date descending) and a Sampler (set to sample the first 1): the Sampled feature will be the most recent reading and the Unsampled features will be the previous readings.


david_r wrote:

If this was a proper SQL database you're writing to, my recommendation would be to write everything to a single table and then define a view that always returns the most recent readings.

Either way, you'll have to define what "current" means in this context. If it's just the latest recording, you can use a Sorter (by date descending) and a Sampler (set to sample the first 1): the Sampled feature will be the most recent reading and the Unsampled features will be the previous readings.

You are correct. Current meaning the lastest readings and the history would be the previous days' recordings so Iets say in a months time I want to be able to go back and look at specific days/recordings and I want it saved in a geodatabase. So would the "Sorter" be the best option for what I'm trying to accomplish.

 


mygis
Supporter
Forum|alt.badge.img+13
  • Supporter
  • August 28, 2018

I would use the DateTimeStamper and create a new Attribute (a field) storing the information together with its unique Date and Time. This way you will be able to get a unique record with the time FME retrieved it from the web.

(I would personally save them as raw flat text files in the hard drive using the stamped time as the file name, but I do not know your environment so that might be the wrong path to take.)

 

 

======================================================================DateTimeStamper

Adds a timestamp to a feature as a new attribute in the form of a date, time (with or without UTC offset), or datetime (with or without UTC offset), in local or UTC time. The timestamps created are in the Standard FME Date/Time Format.

Jump to Configuration

Typical Uses

DateTimeStamper can be used to generate today's date, and be used with DateTimeCalculator to compute tomorrow's and yesterday's dates. It can be used to leave a fractional timestamp on a feature, which allows output features to be sorted and retrieved by timestamps. Timestamps also facilitate comparison operations. To format timestamps for a destination writer, use DateTimeConverter.


david_r
Celebrity
  • August 29, 2018
elisaayalapanto wrote:
You are correct. Current meaning the lastest readings and the history would be the previous days' recordings so Iets say in a months time I want to be able to go back and look at specific days/recordings and I want it saved in a geodatabase. So would the "Sorter" be the best option for what I'm trying to accomplish.

 

The Sorter is there to guarantee that the first feature exiting is the very latest recording, but if your input is already sorted in the right order you could certainly skip the Sorter and go straight for the Sampler.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings