RE: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Ryan Graham

The child nodes can be accessed like properties. For a starts-with
effect, you would use a similar expression that compares the what you
want to search for with the equivalent substring of the name nodes in
that list. You can get more complex and robust searches using string
functions like toLowerCase or RegExps, but this will return the 2 emp
nodes for Johnson and Jones given your input list:
 
var input:String = Jo;
trace(emplist.(name.substring(0, input.length) == input));
 
HTH,
Ryan



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pbrendanc
Sent: Thursday, November 06, 2008 12:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] E4X equivalent to SQL where 'like %' expression ?



I'd like to extract the list of emps from the following XML where name
starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
expression 'where name like 'Jo%'.

Anyone have examples of how this be done via an E4X expression 
(I could not find any examples of this in the docs).

TIA,
Patrick

mx:XMLList id=emplist
emp
id1/id
nameSmith/name
mrn1000/mrn
dob1/1/1964/dob
/emp
emp
id2/id
nameJones/name
mrn1001/mrn
dob11/11/1951/dob
/emp
emp
id3/id
nameJohnson/name
mrn1003/mrn
dob3/3/1953/dob
/emp
/mx:XMLList



 


This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.

RE: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Ryan Graham

Haha, looking at that, a more intuitive option would probably use the
indexOf() function instead of substring, that way 
 
indexOf(input) == 0; //starts-with behavior
indexOf(input)  -1; //contains behavior
 
HTH,
Ryan



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 3:00 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?



The child nodes can be accessed like properties. For a starts-with
effect, you would use a similar expression that compares the what you
want to search for with the equivalent substring of the name nodes in
that list. You can get more complex and robust searches using string
functions like toLowerCase or RegExps, but this will return the 2 emp
nodes for Johnson and Jones given your input list:
 
var input:String = Jo;
trace(emplist.(name.substring(0, input.length) == input));
 
HTH,
Ryan



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pbrendanc
Sent: Thursday, November 06, 2008 12:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] E4X equivalent to SQL where 'like %' expression ?



I'd like to extract the list of emps from the following XML where name
starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
expression 'where name like 'Jo%'.

Anyone have examples of how this be done via an E4X expression 
(I could not find any examples of this in the docs).

TIA,
Patrick

mx:XMLList id=emplist
emp
id1/id
nameSmith/name
mrn1000/mrn
dob1/1/1964/dob
/emp
emp
id2/id
nameJones/name
mrn1001/mrn
dob11/11/1951/dob
/emp
emp
id3/id
nameJohnson/name
mrn1003/mrn
dob3/3/1953/dob
/emp
/mx:XMLList



This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.


 


This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.

RE: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Tracy Spratt
If you need complex calculations within an e4x expression, you can call
out to a function of your own.  The () just requires a boolean value, so
you can do something like below, where I wanted to a bit of string
manipulation within the expression:

 

xlFilteredItems =
_xmlData..item.(itemContains(attribute(item),sFilterString))

 

and the function:

 

  private function itemContains(sItem:String, sMatch:String):Boolean  {

sItem = sItem.toLowerCase();

sMatch = sMatch.toLowerCase();

return (sItem.indexOf(sMatch) != -1);

  }//itemContains

 

Obviously you can do just about anything inside such a function
including traversing the xml, and looping etc.

Tracy



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 5:07 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

 

Haha, looking at that, a more intuitive option would probably use the
indexOf() function instead of substring, that way 

 

indexOf(input) == 0; //starts-with behavior

indexOf(input)  -1; //contains behavior

 

HTH,

Ryan

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 3:00 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

The child nodes can be accessed like properties. For a starts-with
effect, you would use a similar expression that compares the what you
want to search for with the equivalent substring of the name nodes in
that list. You can get more complex and robust searches using string
functions like toLowerCase or RegExps, but this will return the 2 emp
nodes for Johnson and Jones given your input list:

 

var input:String = Jo;
trace(emplist.(name.substring(0, input.length) == input));

 

HTH,

Ryan

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pbrendanc
Sent: Thursday, November 06, 2008 12:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

I'd like to extract the list of emps from the following XML where name
starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
expression 'where name like 'Jo%'.

Anyone have examples of how this be done via an E4X expression 
(I could not find any examples of this in the docs).

TIA,
Patrick

mx:XMLList id=emplist
emp
id1/id
nameSmith/name
mrn1000/mrn
dob1/1/1964/dob
/emp
emp
id2/id
nameJones/name
mrn1001/mrn
dob11/11/1951/dob
/emp
emp
id3/id
nameJohnson/name
mrn1003/mrn
dob3/3/1953/dob
/emp
/mx:XMLList

This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.

This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.

 



RE: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Ryan Graham

Ah, like a true lambda expression -- good tip!



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, November 06, 2008 3:46 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?



If you need complex calculations within an e4x expression, you can call
out to a function of your own.  The () just requires a boolean value, so
you can do something like below, where I wanted to a bit of string
manipulation within the expression:

xlFilteredItems =
_xmlData..item.(itemContains(attribute(item),sFilterString))

and the function:

  private function itemContains(sItem:String, sMatch:String):Boolean  {

sItem = sItem.toLowerCase();

sMatch = sMatch.toLowerCase();

return (sItem.indexOf(sMatch) != -1);

  }//itemContains

Obviously you can do just about anything inside such a function
including traversing the xml, and looping etc.

Tracy



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 5:07 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

Haha, looking at that, a more intuitive option would probably use the
indexOf() function instead of substring, that way 

indexOf(input) == 0; //starts-with behavior

indexOf(input)  -1; //contains behavior

HTH,

Ryan



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 3:00 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

The child nodes can be accessed like properties. For a starts-with
effect, you would use a similar expression that compares the what you
want to search for with the equivalent substring of the name nodes in
that list. You can get more complex and robust searches using string
functions like toLowerCase or RegExps, but this will return the 2 emp
nodes for Johnson and Jones given your input list:

var input:String = Jo;
trace(emplist.(name.substring(0, input.length) == input));

HTH,

Ryan



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pbrendanc
Sent: Thursday, November 06, 2008 12:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

I'd like to extract the list of emps from the following XML where name
starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
expression 'where name like 'Jo%'.

Anyone have examples of how this be done via an E4X expression 
(I could not find any examples of this in the docs).

TIA,
Patrick

mx:XMLList id=emplist
emp
id1/id
nameSmith/name
mrn1000/mrn
dob1/1/1964/dob
/emp
emp
id2/id
nameJones/name
mrn1001/mrn
dob11/11/1951/dob
/emp
emp
id3/id
nameJohnson/name
mrn1003/mrn
dob3/3/1953/dob
/emp
/mx:XMLList

This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.

This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.

 


This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.

Re: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Josh McDonald
It's a great syntax. The real question now becomes: When are we going to
get to run .() on Array, Proxy, and IList?


On Fri, Nov 7, 2008 at 8:32 AM, Ryan Graham [EMAIL PROTECTED] wrote:

  Ah, like a true lambda expression -- good tip!

  --
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Tracy Spratt
 *Sent:* Thursday, November 06, 2008 3:46 PM

 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

   If you need complex calculations within an e4x expression, you can call
 out to a function of your own.  The () just requires a boolean value, so you
 can do something like below, where I wanted to a bit of string manipulation
 within the expression:

 xlFilteredItems =
 _xmlData..item.(itemContains(attribute(item),sFilterString))

 and the function:

   private function itemContains(sItem:String, sMatch:String):Boolean  {

 sItem = sItem.toLowerCase();

 sMatch = sMatch.toLowerCase();

 return (sItem.indexOf(sMatch) != -1);

   }//itemContains

 Obviously you can do just about anything inside such a function including
 traversing the xml, and looping etc.

 Tracy
  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Ryan Graham
 *Sent:* Thursday, November 06, 2008 5:07 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

   Haha, looking at that, a more intuitive option would probably use the
 indexOf() function instead of substring, that way

  indexOf(input) == 0; //starts-with behavior

 indexOf(input)  -1; //contains behavior

  HTH,

 Ryan

  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Ryan Graham
 *Sent:* Thursday, November 06, 2008 3:00 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

 The child nodes can be accessed like properties. For a starts-with effect,
 you would use a similar expression that compares the what you want to search
 for with the equivalent substring of the name nodes in that list. You can
 get more complex and robust searches using string functions like toLowerCase
 or RegExps, but this will return the 2 emp nodes for Johnson and Jones given
 your input list:

 var input:String = Jo;
 trace(emplist.(name.substring(0, input.length) == input));

 HTH,

 Ryan

  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *pbrendanc
 *Sent:* Thursday, November 06, 2008 12:03 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] E4X equivalent to SQL where 'like %' expression ?

 I'd like to extract the list of emps from the following XML where name
 starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
 expression 'where name like 'Jo%'.

 Anyone have examples of how this be done via an E4X expression
 (I could not find any examples of this in the docs).

 TIA,
 Patrick

 mx:XMLList id=emplist
 emp
 id1/id
 nameSmith/name
 mrn1000/mrn
 dob1/1/1964/dob
 /emp
 emp
 id2/id
 nameJones/name
 mrn1001/mrn
 dob11/11/1951/dob
 /emp
 emp
 id3/id
 nameJohnson/name
 mrn1003/mrn
 dob3/3/1953/dob
 /emp
 /mx:XMLList

 This message is private and confidential. If you have received it in error,
 please notify the sender and remove it from your system.

 This message is private and confidential. If you have received it in error,
 please notify the sender and remove it from your system.

  
 This message is private and confidential. If you have received it in error,
 please notify the sender and remove it from your system.




-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk


RE: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Ryan Graham

That would be a great feature. Maybe in FB4? The addition of typed
collections through Vectors seems like it would allow this as well as:

*   
 the ability to have some good type code hinting while writing
loops that iterate Vectors
*   
standard aggregate functions like sum, group, etc through an
interface named something like IEnumerable

Wait a minute, this is starting to sound a little too much like C#. :)
Would still be some awesome features though! I'm all for it.



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Thursday, November 06, 2008 3:46 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?



It's a great syntax. The real question now becomes: When are we going
to get to run .() on Array, Proxy, and IList?



On Fri, Nov 7, 2008 at 8:32 AM, Ryan Graham [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:


Ah, like a true lambda expression -- good tip!



From: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com ] On Behalf Of Tracy Spratt
Sent: Thursday, November 06, 2008 3:46 PM 

To: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com 
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?





If you need complex calculations within an e4x expression, you
can call out to a function of your own.  The () just requires a boolean
value, so you can do something like below, where I wanted to a bit of
string manipulation within the expression:



xlFilteredItems =
_xmlData..item.(itemContains(attribute(item),sFilterString))



and the function:



  private function itemContains(sItem:String,
sMatch:String):Boolean  {

sItem = sItem.toLowerCase();

sMatch = sMatch.toLowerCase();

return (sItem.indexOf(sMatch) != -1);

  }//itemContains



Obviously you can do just about anything inside such a function
including traversing the xml, and looping etc.

Tracy





From: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com ] On Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 5:07 PM
To: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com 
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?



Haha, looking at that, a more intuitive option would probably
use the indexOf() function instead of substring, that way 



indexOf(input) == 0; //starts-with behavior

indexOf(input)  -1; //contains behavior



HTH,

Ryan







From: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com ] On Behalf Of Ryan Graham
Sent: Thursday, November 06, 2008 3:00 PM
To: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com 
Subject: RE: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

The child nodes can be accessed like properties. For a
starts-with effect, you would use a similar expression that compares the
what you want to search for with the equivalent substring of the name
nodes in that list. You can get more complex and robust searches using
string functions like toLowerCase or RegExps, but this will return the 2
emp nodes for Johnson and Jones given your input list:



var input:String = Jo;
trace(emplist.(name.substring(0, input.length) == input));



HTH,

Ryan







From: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com ] On Behalf Of pbrendanc
Sent: Thursday, November 06, 2008 12:03 PM
To: flexcoders@yahoogroups.com
mailto:flexcoders@yahoogroups.com 
Subject: [flexcoders] E4X equivalent to SQL where 'like %'
expression ?

I'd like to extract the list of emps from the following XML
where name
starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
expression 'where name like 'Jo%'.

Anyone have examples of how this be done via an E4X expression 
(I could not find any examples of this in the docs).

TIA,
Patrick

mx:XMLList id=emplist
emp
id1/id
nameSmith/name
mrn1000/mrn
dob1/1/1964/dob
/emp
emp
id2/id
nameJones/name
mrn1001/mrn

Re: [flexcoders] E4X equivalent to SQL where 'like %' expression ?

2008-11-06 Thread Josh McDonald
It can't be in 4 as it'd require an update to Player, and Fx4 is using
Player 10.

We definitely need some serious upgrades to AIR, and to AS3 / AVM for Player
11 (or a 9.5 if I had my way)... It's too damned close to awesome, but
Silverlight 3 will become a big threat if the development environment ever
goes cross-platform as it's going to include an AIR competitor. As it is
now, JavaFX is stupid, but Update 10 (and to a lesser degree FX Script) will
also be a good platform for a solid competitor to Flex.

Frankly as long as it's not from Microsoft, I don't mind who wins, since I'm
a Java guy from way back. But I much prefer AS3 over FX Script.

-Josh

On Fri, Nov 7, 2008 at 8:57 AM, Ryan Graham [EMAIL PROTECTED] wrote:

  That would be a great feature. Maybe in FB4? The addition of typed
 collections through Vectors seems like it would allow this as well as:

-  the ability to have some good type code hinting while writing loops
that iterate Vectors
- standard aggregate functions like sum, group, etc through an
interface named something like IEnumerable

 Wait a minute, this is starting to sound a little too much like C#. :)
 Would still be some awesome features though! I'm all for it.

  --
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Josh McDonald
 *Sent:* Thursday, November 06, 2008 3:46 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

  It's a great syntax. The real question now becomes: When are we going to
 get to run .() on Array, Proxy, and IList?


 On Fri, Nov 7, 2008 at 8:32 AM, Ryan Graham [EMAIL PROTECTED]wrote:

  Ah, like a true lambda expression -- good tip!

  --
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Tracy Spratt
 *Sent:* Thursday, November 06, 2008 3:46 PM

 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

 If you need complex calculations within an e4x expression, you can
 call out to a function of your own.  The () just requires a boolean value,
 so you can do something like below, where I wanted to a bit of string
 manipulation within the expression:

 xlFilteredItems =
 _xmlData..item.(itemContains(attribute(item),sFilterString))

 and the function:

   private function itemContains(sItem:String, sMatch:String):Boolean  {

 sItem = sItem.toLowerCase();

 sMatch = sMatch.toLowerCase();

 return (sItem.indexOf(sMatch) != -1);

   }//itemContains

 Obviously you can do just about anything inside such a function including
 traversing the xml, and looping etc.

 Tracy
  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Ryan Graham
 *Sent:* Thursday, November 06, 2008 5:07 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

   Haha, looking at that, a more intuitive option would probably use the
 indexOf() function instead of substring, that way

  indexOf(input) == 0; //starts-with behavior

 indexOf(input)  -1; //contains behavior

  HTH,

 Ryan

  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Ryan Graham
 *Sent:* Thursday, November 06, 2008 3:00 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] E4X equivalent to SQL where 'like %'
 expression ?

 The child nodes can be accessed like properties. For a starts-with effect,
 you would use a similar expression that compares the what you want to search
 for with the equivalent substring of the name nodes in that list. You can
 get more complex and robust searches using string functions like toLowerCase
 or RegExps, but this will return the 2 emp nodes for Johnson and Jones given
 your input list:

 var input:String = Jo;
 trace(emplist.(name.substring(0, input.length) == input));

 HTH,

 Ryan

  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *pbrendanc
 *Sent:* Thursday, November 06, 2008 12:03 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] E4X equivalent to SQL where 'like %' expression ?

 I'd like to extract the list of emps from the following XML where name
 starts with 'Jo' (returns Jones, Johnson). In SQL I can use the
 expression 'where name like 'Jo%'.

 Anyone have examples of how this be done via an E4X expression
 (I could not find any examples of this in the docs).

 TIA,
 Patrick

 mx:XMLList id=emplist
 emp
 id1/id
 nameSmith/name
 mrn1000/mrn
 dob1/1/1964/dob
 /emp
 emp
 id2/id
 nameJones/name
 mrn1001/mrn
 dob11/11/1951/dob
 /emp
 emp
 id3/id
 nameJohnson/name
 mrn1003/mrn
 dob3/3/1953/dob
 /emp
 /mx:XMLList

 This message is private and confidential. If you have received it in
 error, please notify the sender and remove it from your system.

 This message