Hi Mark,

Although I have no experience with this process, the following came to my mind 
when pondering the same issue as yours.

My plan was to keep a history table which tracks all of the updates and 
additions to data (would be simply recording row ids - not the entire row), and 
records a timestamp of when it was changed. This functionality would be coded 
into the server-side code. You would also need a sessions table to track a 
"last synced" timestamp for each user, which would be updated with the current 
timestamp on each sync of the data.

Every 60 seconds or so you would poll the server and it would return all of the 
rows that were either changed, added or deleted since the "last synced" 
timestamp. Once that data is delivered back to flex, simply loop through the 
data on the client side and replace the rows where the id's match, add a row if 
it's new, and delete the row if it's deleted.

You'd probably also want a cron cleaning up the history table periodically, 
depending on how many users there are and how frequently data is updated.

>From my perspective, this would be a pretty fast operation all up. You could 
>even optimise the SQL query so that it joins the history table id's to the 
>data table. As long as all steps go smoothly, the data should always be 
>current (within 60 sec window of course). The only real hurdle I see is that 
>your app needs to know which id's are updated. This might not be a problem if 
>you update and delete items based on id's, but if you do something like 
>[delete from mydata where name = 'fred'], you will need to know the id's 
>before deleting them.

I hope that gives an insight to how I would tackle the problem. Any others want 
to give feedback on this method?

Cheers,
Adam


  ----- Original Message ----- 
  From: oneproofdk 
  To: flexcoders@yahoogroups.com 
  Sent: Wednesday, February 07, 2007 6:41 PM
  Subject: [flexcoders] Poor man's PUSH technology (aka reload data using timer)


  I am building a internal app for my company, where we would eventually
  pursue FDS for it's push capabilities - updating the users view when
  backend data changes.

  Until then, I'm thinking about making a function that will get
  triggered by a timer, e.g. every 60 seconds, it should retrieve data
  from the server and then compare it to the data currently displayed in
  the app [Binded]. Then if data has changed, it should update the
  specific data in the ArrayCollection.

  Any pointers to how I could accomplish this ?

  Im thinking a function "dataTimer" that would call a function
  "getData", that function would then compare each row in the dataset to
  the data currently "in memory" in the app. If there's a difference, it
  would update the data OR completely replace the currently used
  dataset. (only I guess that would make the app flicker?)

  Any help is greatly appreciated.

  Thanks,
  Mark



   

Reply via email to