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>
<id>1</id>
<name>Smith</name>
<mrn>1000</mrn>
<dob>1/1/1964</dob>
</emp>
<emp>
<id>2</id>
<name>Jones</name>
<mrn>1001</mrn>
<dob>11/11/1951</dob>
</emp>
<emp>
<id>3</id>
<name>Johnson</name>
<mrn>1003</mrn>
<dob>3/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.

Reply via email to