0 Replies Latest reply on Feb 17, 2008 5:55 PM by louis_ci

    searching xml what type of value is returned

      Hi, I was wondering if someone could help me with this problem. I have a set of if commands that are designed to take the input from a text field and search three different fields for the value that's been typed in. If the text is present in ANY of the three fields I want it to be returned in the XML list.

      if (searchXMLl.(serviceName.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1)) {
      var searchXMLm:XMLList = searchXMLl.(serviceName.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1);
      }
      else {
      var searchXMLm:XMLList = searchXMLl;
      }

      if (searchXMLl.(shortDesc.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1)) {
      var searchXMLn:XMLList = searchXMLm.(shortDesc.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1);
      }
      else {
      var searchXMLn:XMLList = searchXMLm;
      }

      if (searchXMLl.(tags.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1)) {
      var searchXMLo:XMLList = searchXMLn.(tags.toLowerCase().search(freeTextAllSearch.text.toLowerCase()) > -1);
      }
      else {
      var searchXMLo:XMLList = searchXMLn;
      }

      This is the code I have so far. I'm sure this is not the best way to go about it but I'm running low on ideas!
      The problem I have is that the if commands always seem to be evaluating to true and hence even if the input isn't in the field, it will return an empty xml object. I've tried changing it to be >0 but that doesn't seem to work.

      Can anyone please help me write an expression that takes the value in the input box, search the relevant field and return either the value or if it is empty?

      Thanks!