Gerald, Your result handler function should be
private function resultHandler(e:ResultEvent):void{ if(e.result.catlog != null) myAC = e.result.catalog.product as ArrayCollection; else{ Alert.show("error"); } } HTH, -Ravi On Jul 31, 2:14 pm, Gerald Anto Fernando <flex.gerald.a...@gmail.com> wrote: > Hi ravi, > *This is my exact returning node from server* > <?xml version="1.0" encoding="utf-8" ?> > <catalog> > <product timeField="09:55:33"> > <price>1015.0</price> > <change>-0.42</change> > </product> > <product timeField="09:57:03"> > <price>1006.1</price> > <change>-1.3</change> > </product> > <product timeField="09:59:03"> > <price>1015.9</price> > <change>-0.33</change> > </product> > <product timeField="10:01:03"> > <price>1011.5</price> > <change>-0.77</change> > </product> > <product timeField="10:03:33"> > <price>1012.7</price> > <change>-0.65</change> > </product> > </catalog> > > *if data is not available in server it shows a page like > * > <?xml version="1.0" encoding="utf-8" ?> > <catalog /> > > *The following is my jsp code* i will call this page from flex http > service.when i run this page it shows the result like > what i have mentioned above(in case of data available) > > else > > it shows like > <?xml version="1.0" encoding="utf-8" ?> > <catalog /> > > *JSP Code* > <%...@page language="java" import="java.util.*, java.text.SimpleDateFormat, > connection.DBConnection, java.sql.*"%> > <?xml version="1.0" encoding="utf-8"?> > <catalog> > <% > String currentDate, dateFrame = null, type = null, symbol = null, query = > null; > String startTime = "09:54:00",endTime = "15:45:00",timeFrom = null,timeTo > = null, dbName="intraday"; > int typeValue = 0; > Connection con = null; > ResultSet rs = null; > DBConnection db = null; > > type = request.getParameter("option"); > symbol = request.getParameter("symbolName"); > dateFrame = request.getParameter("dateFrame"); > > if(dateFrame == null) > { > Calendar c = Calendar.getInstance(); > c.add(Calendar.DATE, -1); > SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); > currentDate = dateFormat.format(c.getTime()); > } > else > { > currentDate = dateFrame; > } > > currentDate +=" "; > timeFrom = currentDate+startTime; > timeTo = currentDate+endTime; > > if((type == null)||(type.equals("Future1"))) > typeValue = 1; > else if(type.equals("Future2")) > typeValue = 2; > else > typeValue = 3; > > if(symbol == null) > symbol = "ABAN"; > > query ="select intradate,price,change from future where type > ="+typeValue+" and symbol='"+symbol+"'"; > query +=" and intradate between '"+timeFrom+"' and '"+timeTo+"'"; > > if(db == null) > { > db = new DBConnection(); > db.setProperties(); > db.set_dbName(dbName); > //con = db.getServerConnection(); > db.getServerConnection(); > } > rs = db.getResultSet(query); > try{ > > while(rs.next()){ > > <product timeField="<%= rs.getTime(1)%>"> > <price><%=rs.getDouble(2) %></price> > <change><%=rs.getDouble(3) %></change> > </product> > <% > } > rs = null; > db = null; > } > catch(Exception e){ > out.println("could not open the Connection to Server"); > e.printStackTrace(); > } > %> > > </catalog> > > hope this will help you to give me solution > > Thanks > Gerald A > > > > On Fri, Jul 31, 2009 at 2:07 PM, Ravi Mishra <ravi.achi...@gmail.com> wrote: > > > Gerald, > > > Can you send the snippet which is working? Because i think the format > > of the XML you have sent is not correct. (I have removed all those > > asterisks '*') > > > -Ravi > > > On Jul 31, 12:55 pm, Gerald Anto Fernando <flex.gerald.a...@gmail.com> > > wrote: > > > Hello friend, > > > i have tried some ways but didnt get a result > > > > my xml node is being like > > > > <?xml version="1.0" encoding="utf-8" ?> > > > *-*<http://localhost:8080/charts/pages/intraData.jsp#> > > > <catalog> > > > *-* <http://localhost:8080/charts/pages/intraData.jsp#> <product > > timeField > > > ="*09:55:33*"> > > > * * <price>*1015.0*</price> > > > * * <change>*-0.42*</change> > > > * * </product> > > > *-* <http://localhost:8080/charts/pages/intraData.jsp#> <product > > timeField > > > ="*09:57:03*"> > > > * * <price>*1006.1*</price> > > > * * <change>*-1.3*</change> > > > * * </product> > > > *-* <http://localhost:8080/charts/pages/intraData.jsp#> <product > > timeField > > > ="*09:59:03*"> > > > * * <price>*1015.9*</price> > > > * * <change>*-0.33*</change> > > > * * </product> > > > *-* <http://localhost:8080/charts/pages/intraData.jsp#> <product > > timeField > > > ="*10:01:03*"> > > > * * <price>*1011.5*</price> > > > * * <change>*-0.77*</change> > > > * * </product> > > > *-* <http://localhost:8080/charts/pages/intraData.jsp#> <product > > timeField > > > ="*10:03:33*"> > > > * * <price>*1012.7*</price> > > > * * <change>*-0.65*</change> > > > * * </product> > > > </catalog> > > > > if data is not available > > > > <?xml version="1.0" encoding="utf-8" ?> > > > * * <catalog /> > > > could you please elobrate your code according to mine > > > > Thanks&Regards, > > > Gerald A > > > > On Wed, Jul 29, 2009 at 4:38 PM, hsivaramakrish...@gmail.com < > > > > hsivaramakrish...@gmail.com> wrote: > > > > > There are multiple ways of solving this. > > > > > Simplest is to do a null check before assigning. > > > > > Even when you get a single non null ObjectProxy in your result, you > > > > will get a coercion error while Assigning to ArrayCollection. > > > > > Do something like this > > > > > if(event.result.node is ArrayCollection) > > > > { > > > > myCollection = event.result.node as ArrayCollection; > > > > } > > > > else > > > > { > > > > myCollection = new ArrayCollection(); > > > > myCollection.addItem(event.result.node); > > > > > } > > > > > Harish > > > > Evangelist, Adobe India > > > > > On Jul 29, 2:55 pm, Gerald Anto <flex.gerald.a...@gmail.com> wrote: > > > > > Hello Frineds, > > > > > my client page(mxml) calls one jsp that will return xml data. > > > > > then i populate that data in chart . its working fine. > > > > > supose there is no data from server side it shows the error like > > > > > cannot be refferenced null object or property. > > > > > > In my result event i assign the xml node(from server) in to > > > > > ArrayCollection and bind to the chart DataProvider > > > > > > in fault event Alert message will be shown. > > > > > > How can i solve it > > > > > Please give me some idea > > > > > > Thanks&Regards, > > > > > Gerald A > > > > -- > > > Thanks & Regards, > > > A Gerald > > -- > Thanks & Regards, > A Gerald --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---