Link to home
Create AccountLog in
Avatar of kmaynard
kmaynardFlag for New Zealand

asked on

How do I use [DataSet]PageProducer to generate static HTML periodically?

I have a Service on W2008 Server R2 written in Delphi 7 which updates a database every 10 minutes with readings from my home weather station. It uploads readings to WeatherUnderground, but I want to simultaneously generate an  html page on my webserver. So, basically the thing is kicked off by a timer in a service, not by an incoming web request. I put DataSetPageProducer on the service datamodule, and it successfully translates the <#tag> fields from the database if I do str := DataSetPageProducer1.content. The problem is that I want to feed this to a PageProducer component to substitute some additional tags, but the first operation strips them out. I thought is was possible to chain such operations? But I don't have access to the 'handled' property, which is I think what is needed? It's probably in some parent entity which is bypassed by my strategy. Is there any way round this? I could just leave the data in the database and write an ISAPI to get the data on the fly, but I don't really want to have to maintain yet another thing.
Avatar of jimyX
jimyX

Could you rephrase please, I am trying to help but I am not sure I got what is your problem exactly.

You do translation of some tags from the database and assign the result to a variable. But you are trying to work on the first version of data before translation, with PageProducer, to translate some other information, is that what you are saying?
Avatar of kmaynard

ASKER

Sorry it's not clear.  I want to generate a web page every 10 minutes to show weather information. I have a template html doc containing PageProducer tags of the form <#tagx>. The tags correspond to fields in 2 MySQL tables, plus a few extras for date and time. How do I go about getting all these tags substituted with the database values into a string, preferably without laboriously coding the db-field tags in an OnHTMLTag action? I can then write the string to an html file on the webserver.
ASKER CERTIFIED SOLUTION
Avatar of jimyX
jimyX

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
The proposed solution is workable, so I will award the points. Thanks for the suggestion, but I really didn't want to do all that coding. In the end, I wrote a single SQL statement that extracted data from both tables, so I could use a single DataSetPageProducer component for the db fields, and an onHTMLtag to handle the remaining tags.