Thanks Tracy - I owe you, big time! -Dave
--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > private function initUI():Void > { > aDPCombined = new Array(); > var aPulseLoansToday:Array = modelPulse.PulseLoansToday; > var aPulseLoansYesterday:Array = > modelPulseYesterday.PulseLoansToday; > var oItem:Object; > var oItemYesterday:Object; > var nGrowth:Number; > //********************************************* > for ( var i:Number=0; i<aPulseLoansToday.length; i++ ) { > oItem = aPulseLoansToday[i]; > oItemYesterday = aPulseLoansYesterday[i]; > nGrowth = Number(oItem.TOTALBAL) - > Number(oItemYesterday.TOTALBAL);//************************** > var oItemCombined:Object = new > Object({SCHEDDATE:oItem.SCHEDDATE, > > CATEGORY:oItem.CATEGORY, > > TODAY:oItem.TOTALBAL, > > YESTERDAY:oItemYesterday.TOTALBAL, > > GROWTH:nGrowth});//***************************** > aDPCombined.addItem(oItemCombined); > }//for ( var i:Number=0;.... > } > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Dave > Sent: Friday, April 29, 2005 9:10 AM > To: [email protected] > Subject: [flexcoders] Re: Multiple dataProviders for 1 dataGrid?? > > Tracy, > > Thanks for your help. Now I have to add other fields from other > dataproviders but I think I can handle it. > > I know this is probably AS 101, but how do I create an object in the > new array that is a product of a math function between 2 other > objects in the new array? > > Example: I need to create a column in the datagrid called GROWTH > that is simply the difference between TOTALBAL for today and > TOTALBAL for yesterday (TODAY - YESTERDAY). Everything I try results > in NaN. > > > Thanks for your patience. > > -Dave > > --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> > wrote: > > The example is attached, along with the sample xml files I created > to > > test it. > > > > Your array exists at result.diffgram.PulseLoansToday. In the > example I > > left the diffgram node out of my test xml. > > > > Basically, you assign the today and yesterday arrays to variables, > > iterate through the today items, get the matching yesterday item, > build > > a combined item object, and add it to the combined dataProvider > array, > > which is bound to the DataGrid DataProvider. > > > > Tracy > > > > -----Original Message----- > > From: [email protected] > [mailto:[EMAIL PROTECTED] On > > Behalf Of Dave > > Sent: Thursday, April 28, 2005 6:24 PM > > To: [email protected] > > Subject: [flexcoders] Re: Multiple dataProviders for 1 dataGrid?? > > > > OK. Let me backup. Below is a sample of the data returned (an > array > > of objects?) from the WS with the date specified as 1/10/2005. The > > dataProvider for the datagrid > > > is "{service1.PulseLoansToday.result.diffgram.PulseLoansToday.PulseLo > > ansToday}" > > > > Binding to the dataProvider as specified produces the desired > > results within the datagrid (using "CATEGORY", "TOTALBAL", etc. as > > the column names). > > > > Here's the rub; within the SAME datagrid, I need to display one > > column of TOTALBAL for the selected date(1/10/2005 in this case), > > and another column of TOTALBAL for yesterday's date (thisDate > > request is empty so default is previous day's date). Since I can > > only bind a datagrid to one dataProvider, I need a way to combine > > the results into a new dataProvider that I can bind to the > datagrid. > > > > Thanks for your help, > > > > -Dave > > > > SAMPLE DATA RETURNED FROM WEB SERVICE > > <?xml version="1.0" encoding="UTF-8"?> > > <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > > <soap:Body> > > <PulseLoansTodayResponse xmlns="http://srv-corp- > > sql/XmlWebServices/"> > > <PulseLoansTodayResult> > > <xs:schema xmlns:msdata="urn:schemas-microsoft- com:xml- > > msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" > > id="PulseLoansToday"> > > <xs:element name="PulseLoansToday" > > msdata:IsDataSet="true"> > > <xs:complexType> > > <xs:choice maxOccurs="unbounded"> > > <xs:element name="PulseLoansToday"> > > <xs:complexType> > > <xs:sequence> > > <xs:element name="SCHEDDATE" > > type="xs:string" minOccurs="0"/> > > <xs:element name="CATEGORY" > > type="xs:string" minOccurs="0"/> > > <xs:element name="TOTALBAL" > > type="xs:decimal" minOccurs="0"/> > > <xs:element name="TOTALCNT" > > type="xs:decimal" minOccurs="0"/> > > <xs:element name="SORTBY" > > type="xs:int" minOccurs="0"/> > > </xs:sequence> > > </xs:complexType> > > </xs:element> > > </xs:choice> > > </xs:complexType> > > </xs:element> > > </xs:schema> > > <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft- > > com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml- > > msdata"> > > <PulseLoansToday xmlns=""> > > <PulseLoansToday diffgr:id="PulseLoansToday1" > > msdata:rowOrder="0"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>1-NEW VEHICLE</CATEGORY> > > <TOTALBAL>61427820.1900</TOTALBAL> > > <TOTALCNT>3177</TOTALCNT> > > <SORTBY>1</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday2" > > msdata:rowOrder="1"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>2-USED VEHICLE</CATEGORY> > > <TOTALBAL>51179669.7000</TOTALBAL> > > <TOTALCNT>4322</TOTALCNT> > > <SORTBY>2</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday3" > > msdata:rowOrder="2"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>3-UNSECURED</CATEGORY> > > <TOTALBAL>997362.0700</TOTALBAL> > > <TOTALCNT>761</TOTALCNT> > > <SORTBY>3</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday4" > > msdata:rowOrder="3"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>4-EQUITY MORTGAGES</CATEGORY> > > <TOTALBAL>11356456.8100</TOTALBAL> > > <TOTALCNT>545</TOTALCNT> > > <SORTBY>4</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday5" > > msdata:rowOrder="4"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>5-HELOC FIXED</CATEGORY> > > <TOTALBAL>2665131.6800</TOTALBAL> > > <TOTALCNT>94</TOTALCNT> > > <SORTBY>5</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday6" > > msdata:rowOrder="5"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>6-HELOC VARIABLE</CATEGORY> > > <TOTALBAL>1452584.3100</TOTALBAL> > > <TOTALCNT>152</TOTALCNT> > > <SORTBY>6</SORTBY> > > </PulseLoansToday> > > <PulseLoansToday diffgr:id="PulseLoansToday7" > > msdata:rowOrder="6"> > > <SCHEDDATE>01/10/2005</SCHEDDATE> > > <CATEGORY>7-FIXED</CATEGORY> > > <TOTALBAL>6617278.6300</TOTALBAL> > > <TOTALCNT>255</TOTALCNT> > > <SORTBY>7</SORTBY> > > </PulseLoansToday> > > </PulseLoansToday> > > </diffgr:diffgram> > > </PulseLoansTodayResult> > > </PulseLoansTodayResponse> > > </soap:Body> > > </soap:Envelope> > > > > > > --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> > > wrote: > > > Well, this is definitely on topic, so lets keep it here. > Besides, > > > someone else might be able to help. > > > > > > An Object is NOT the same as an array of Objects, at least from > a > > list > > > dataProvider standpoint. But there has to be an array in there > > > somewhere! Sometimes the array is at result[0], and not at > result. > > > > > > What are you using to debug? Flex Builder? Can you examine the > > result > > > object? > > > Did you try the for loop? If you have an object, that might not > > work. > > > But it might with result[0]. > > > Also try: > > > for (var key in result){ > > > trace(key + ":" + result[key]); > > > } > > > > > > We can also try specifying the result to be in xml. > > > > > > We need to know exactly what our data looks like. > > > > > > Do the current results display in the datagrid? If so, how are > you > > > specifying the dataProvider and the column sources? > > > > > > Tracy > > > > > > -----Original Message----- > > > From: [email protected] > > [mailto:[EMAIL PROTECTED] On > > > Behalf Of Dave > > > Sent: Thursday, April 28, 2005 3:14 PM > > > To: [email protected] > > > Subject: [flexcoders] Re: Multiple dataProviders for 1 dataGrid?? > > > > > > Thanks for helping on this - my butt is on the line! YES - the > WS > > is > > > sending back result type of Object. > > > > > > You can respond to [EMAIL PROTECTED] if you prefer. > > > > > > > > > Thanks, > > > > > > -Dave > > > > > > --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> > > > wrote: > > > > What is your result type? Object(default), xml > > > (resultFormat="xml"). If > > > > you think it is an array of objects (the best case), then in > > your > > > result > > > > handler, run a test like this: > > > > > > > > for ( i:Number=0;i<result.length;i++){ > > > > trace(result[i].someObjectpropertyName) > > > > } > > > > Do you see what you expect? If so, I'll write a quick example > > > that will > > > > use two such arrays of objects to build a third suitable for a > > > > dataProvider. > > > > Tracy > > > > > > > > -----Original Message----- > > > > From: [email protected] > > > [mailto:[EMAIL PROTECTED] On > > > > Behalf Of Dave > > > > Sent: Thursday, April 28, 2005 10:03 AM > > > > To: [email protected] > > > > Subject: [flexcoders] Re: Multiple dataProviders for 1 > dataGrid?? > > > > > > > > Sorry but I'm not very familiar with AS - can you give me an > > > example > > > > and/or pointers? > > > > > > > > Thanks, > > > > > > > > -Dave > > > > > > > > > > > > --- In [email protected], "Tracy Spratt" > <[EMAIL PROTECTED]> > > > > wrote: > > > > > I think you will need to programmatically combine the two > > > results > > > > into a > > > > > new dataProvider. > > > > > > > > > > This is not difficult in AS, but the details depend on the > > > result > > > > type. > > > > > > > > > > Tracy > > > > > > > > > > -----Original Message----- > > > > > From: [email protected] > > > > [mailto:[EMAIL PROTECTED] On > > > > > Behalf Of Dave > > > > > Sent: Tuesday, April 26, 2005 4:13 PM > > > > > To: [email protected] > > > > > Subject: [flexcoders] Multiple dataProviders for 1 dataGrid?? > > > > > > > > > > > > > > > > > > > > Accessing a web service, in one dataGrid I have a column > that > > > > displays > > > > > the account balance (TOTALBAL) per product.as of current > date. > > > > Another > > > > > column in the same dataGrid displays the account balance > > > > (TOTALBAL) > > > > > but for the date 12/31/2004. I can't figure out a solution > > since > > > > > column names can't be identical. > > > > > > > > > > I duplicate the web service so that I have service1 and > > > service2 - > > > > > where I pass the 12/31/2004 date to service2. So TOTALBAL > for > > > > service1 > > > > > corresponds with current day and TOTALBAL for service2 > > > corresponds > > > > > with 12/31/2004. > > > > > > > > > > Any ideas on how to render this data within the same > dataGrid? > > > > Please > > > > > help ASAP. > > > > > > > > > > Thanks, > > > > > > > > > > -Dave > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

