[flexcoders] Flex 2:CFC can't seem to return the same type

2005-11-03 Thread Greg Johnson
I have a date field that gets returned to Flex2 from a CFC.  Thing is 
when there is a date in it, it returns a date.  When there is no date 
in it, it returns a empty string.

Flex is having indigestion as the Flex variable is of date type.  So 
when a date is returned, its happy, when a empty string is returned, it 
complains about coersion failure from string to date.

If this were a different language I would use something like IsDate, 
but the closest thing to it seems to be the DateValidator which, 
atleast as presented in the documentation, seems more complex then what 
I really need. 

Is there a function in Flex 2 that will accept a date or a empty string 
and will return ether a valid date or an empty date?  Or is there a 
better way to pass the date from the CFC so even when its  flex still 
sees it as a date type?

Thanks





 Yahoo! Groups Sponsor ~-- 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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/
 





Re: RES: [flexcoders] Flex 2:CFC can't seem to return the same type

2005-11-03 Thread Greg Johnson
Nope, haven't tried that yet.

Basicaly what I did to get it to work is to make all my variables in 
Flex2 be strings.  Then when I assign the value returned from the 
CFC, if its a date or number being returned I use String() which will 
convert the number or date to a string representation.

mx:DateFormatter id=StdDateFormat/
mx:CurrenctFormatter id=StdMoneyFormat precision=2/

[Bindable]
public var date_dp:String = new String();
[Bindable]
public var total_dp:String = new String();

date_dp = String(result[0].DATE);
total_dp = String(result[0].TOTAL);

Then in the binding I use a currency formater and a date formater 
which seem to take strings or number/dates as acceptable input and 
output correctly.

mx:Label text={StdDateFormat.format(date_dp)}/
mx:Label text={StdMoneyFormat.format(total_dp)}/


--- In flexcoders@yahoogroups.com, Rafael M. Martinelli 
[EMAIL PROTECTED] wrote:

 Greg,
 
 I'm not sure, but I think that in AS 3.0 you can't assign an empty 
string to
 a Date Object. It's stronglly typed. As well you can't assigns na 
empty
 string to a Numeric variable. You must return 0 or -1 to a numeric 
variable.
 I guess that's the problem.
 
 As you're using Flex2 and ColdFusion, have you tested using session
 variables? It's not working for me and I don't know why. I tested 
the same
 components using just the browser and it worked.
 
 Thanks.
 
 Rafael
 
 -Mensagem original-
 De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
Em nome
 de Greg Johnson
 Enviada em: quinta-feira, 3 de novembro de 2005 15:06
 Para: flexcoders@yahoogroups.com
 Assunto: [flexcoders] Flex 2:CFC can't seem to return the same type
 
 I have a date field that gets returned to Flex2 from a CFC.  Thing 
is when
 there is a date in it, it returns a date.  When there is no date in 
it, it
 returns a empty string.
 
 Flex is having indigestion as the Flex variable is of date type.  
So when a
 date is returned, its happy, when a empty string is returned, it 
complains
 about coersion failure from string to date.
 
 If this were a different language I would use something like 
IsDate, but the
 closest thing to it seems to be the DateValidator which, atleast as
 presented in the documentation, seems more complex then what I 
really need. 
 
 Is there a function in Flex 2 that will accept a date or a empty 
string and
 will return ether a valid date or an empty date?  Or is there a 
better way
 to pass the date from the CFC so even when its  flex still sees 
it as a
 date type?
 
 Thanks
 
 
 
 
 
  Yahoo! Groups Sponsor 
~-- Fair
 play? Video games influencing politics. Click and talk back!
 http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
 
~- 
 
 --
 Flexcoders Mailing List
 FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
 Yahoo! Groups Links
 
 
 
  
 
 
 
 
 
 --
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.361 / Virus Database: 267.12.6/151 - Release Date: 
28/10/2005







 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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/