Groups | Blog | Home
all groups > flash actionscript > october 2005 >

flash actionscript : Complex Conditional Statement with XPath - Urgent Help Needed!


Speak in Tongues
10/17/2005 10:51:40 PM
Hi,

I've got an urgent problem that I have been trying to rack my brain over for
the past week. I need to create a complex conditional statement to use on an
XPath. I'm doing a search on a database using six different checkboxes as:

Class A
[] class1a [] class2a [] class3a

Class B
[] class1b [] class2b [] class3b

Where any combination of these boxes can be checked. These then need to
influence an XPath statement:

var query:String = "//record[CONDITIONS GO HERE]";

Can anyone PLEASE help! I can't make heads or tales of it and haven't slept in
48 hours :( :( trying to solve the problem for a client.

Thanks.

Speak in Tongues
10/18/2005 8:26:17 AM
Randy1969
10/18/2005 8:37:55 AM
Do you have a sniplet of the XML document you are trying to process, this would make helping you possible. What you have here will not allow for this.

Speak in Tongues
10/18/2005 8:48:30 AM
Hi Randy, Thanks for the reply.

Its part of a more complex search where you can search by gender (class A
above), medal (class B above), name,country,event, and year.

The XML is as follows.



<?xml version="1.0" encoding="iso-8859-1"?>
<database>
<!-- Bobsleigh -->
<record>
<year>1932</year>
<discipline>Bobsleigh</discipline>
<event_type>two-man</event_type>
<noc>USA</noc>
<gender>M</gender>
<contestant>UNITED STATES OF AMERICA 01</contestant>
<medal>Gold</medal>
</record>
<record>
<year>1932</year>
<discipline>Bobsleigh</discipline>
<event_type>two-man</event_type>
<noc>SUI</noc>
<gender>M</gender>
<contestant>SWITZERLAND 02</contestant>
<medal>Silver</medal>
</record>
</database>
Randy1969
10/18/2005 9:00:25 AM
So based on what your saying, I assume Class A how you have it listed Above
would be something like:
Select gender:
(x) Male (x) Female (x) Both
Is this correct? If not, what should it be? Or are you just looking for a
generic XPATH, and if so what type of conditional do you want it based off of
OR,AND?

Speak in Tongues
10/18/2005 9:29:03 AM
Randy1969
10/18/2005 10:24:39 AM
Take a look at an example I created at
http://www.telsim.com/flashtest/xpathcreate.swf
Let me know if this is what you needed, the OR and AND implementations are
configurable from the fla easily , so is the conditional compare of the field
and also the value.
Speak in Tongues
10/18/2005 11:35:24 PM
That looks great! Thanks.

Am travelling at the moment so can't yet try it out, but please leave it on
your server for a week if you don't mind. Would love to see fla.

Many thanks. Will let you know how I get on.
Randy1969
10/21/2005 12:52:11 PM
Whenever I place these on the server, I also place the fla in the same directory, you can grab it at :
http://www.telsim.com/flashtest/xpathcreate.fla
Let me know how it worked.

AddThis Social Bookmark Button