Use the last inserted id or something similar... ie:
1) get all the data (all means what you really need, ie: last 100,200 whatever) webservice.getAllData() 2) Put in the list and keep a record of the latest id 3) every x seconds hit the web with webservice.getUpdatesFrom(lastInseretId) This way db is much faster to query, communications are much cheaper (only updates) and so on... ah 4) append the new data to your component's data provider Fotis On Mon, Nov 10, 2008 at 9:11 PM, anuj181 <[EMAIL PROTECTED]> wrote: > Hi Guys > I asked his question earlier too and you guys were helpful in giving > me solution but i ended up implementing solution which consume lot of > resources . > I have a tree which is getting data from Postgres though HTTP service > and binding data in XMLList. As soon as new entry has been added to > the database I need my Tree to be updated. I set a timer and what that > timer does is it calls that HTTP service (And goes through Postgres) > after some time and load all the entries back to the Tree. Now this > solution works but the solution would be pain if there are 2000 > entries in the database and a new entry has been added, then it loops > through all the 2000 entries and put all these entries in the Tree > which takes lots of resources. > In short what i need is that the timer should only go through the > database when new entry has been added in the database and istead of > loading all the entries in the Tree it should only load the added entry. > Please let me know if it is possible to do and if yes which way should > I go. Should I target changing the Flex code or does it have to be > done through post gres. Your help will be appreciated. Below is code > Thanks > Anuj > /*Code*/ > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" > creationComplete="initApp();" > xmlns:nimer="com.mikenimer.components.datagrid.*" > height="758" y="10" x="260" width="800" > backgroundImage="contentPanelTest.swf" backgroundColor="#92959E" > horizontalScrollPolicy="off" verticalScrollPolicy="off"> > > <mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x" > url="http://10.80.3.56:8182/config/devices" > result="devicesXMLHandler(event)" showBusyCursor="true"> > > public function initApp():void > { > pollHttpService(); > //Set the Timer > timer.addEventListener(TimerEvent.TIMER,onTimer); > timer.start(); > } > private function onTimer(event:TimerEvent):void > { > pollHttpService(); > } > //Sets up the URL and invokes Send > private function pollHttpService() > { > var sTime:String=new Date().toTimeString(); > var sURL:String=_sURLData+"?time="+sTime; > trace("url="+sURL); > devicesXML.url=sURL; //to avoid caching > devicesXML.send(); //call for data > } > > > <mx:Tree > dataProvider="{devicesCollection}" > labelField="@id" > dropEnabled="false" > dragEnabled="true" > dragMoveEnabled="false" > labelFunction="treeLabel" > y="79" x="17" height="541" width="317"/> > > > -- Fotis Chatzinikos, Ph.D. Founder, Phinnovation [EMAIL PROTECTED],

