Programming

any one any good at programming here? Just need help with a general algorithm nothing specific.

Im using flex, but need help with actionscript 3. Notation is just like java/C etc

If anyones good with switch statements or if/else statements
hola

Perhaps if you named the algorithm or listed a quick explaination of what it needs to do I might be able to help. All depends on the complexity of the algorithm though. I’m not really big on encryption, compression, and genetic algorithms.

Hey man, its fairly simple [OR SO IT SEEMS] , its really wrecking my head at this stage

http://www.ilovenicii.com/cc.JPG

i need to make a search system, im using actionscript 3, i just need help with an algorithm.

Basically i was having problems as i needed to return a result when
-Only fname was entered
-Only fname was entered
-Both were entered.

obviously checking if they existed in the database [just an xml file]
so i got it working using an If/else statement

Problem now is that i have a date field above, i need to integrate that in
later il also have a city field and it just seems way to complicated for an if/else statement, not sure what to do or how to do it

Process the parameters for the dataDetails.person.blah before calling it.

parameters=0; //undefined, NULL, whatever it needs. thats a weird language.
if (inputA.test!=("")) parameters &=(forename==inputA.text);
if (inputB.test!=("")) parameters &=(surname==inputA.text);
Answer.htmlText=dataDetails.person.(parameters);

Hey Toodles thank you very much for replying.
im not sure what you mean by parameters? at all !!?

do you mean putting it in a variable so its neater?

parameters (in this case) are the strings passed to the function it bases it works on. What toodles is suggesting is that you don’t have to worry about what type of search you have to face, but leave it to the search function. All you have to do is pass the correct string as parameter

hey jugso, i dont quite get you, to make sure the string is CORRECT , i need to check it with the xml file anyway, and i need to make this search function, so not sure WTF !!! thanks for ur reply, could u explain further?

anyway i used a bigger switch statement and it works BUT it seems like its hacked together and i really need a way so it works for any amount of fields !

http://www.ilovenicii.com/done.jpg

Could you explain exactly what the dataDetails.person. method is doing? It’s not 100% clear on how the strings are being linked / compared to the underlying data within the object (dataDetails is an object right?). What about the date? is that searched through dataDetails.date.? Sorry if I’m missing something but I’ve never heard of actionscript. It just seems if you have to do a comparion on every field there no easy to but to cover all the cases in a switch.

What you would want to able to do is consolidate all the fields that need to searched up front, and pass a value to a routine which searches across all those
fields. Are you able to loop through your controls as generic objects and acquire their values? Or do they all have to be accessed by name?

thank u for the reply xorcist.

basically

  • dataDetails is variable of type XMLList
  • Im reading in from an extermal XML file and storing everything in dataDetails.
    -My xml structure is
    <person>
    <forename>Joe</forename>
    <lastname>Bloggs</lastname>
    </person>

so dataDetails.person.forename is a call to ALL the forenames in my XML file
"there no easy to but to cover all the cases in a switch." - i think youre right, thats what i did, each FIELD has an id, but it doesnt allow me to use () or + characters so i cant really loop them.

it works now but i have date as a basic input feild
i need the date to be
FROM: 1700 to 1800

drop down boxes and if the person exists within those dates then retrun result etc
:frowning: