4 Replies Latest reply on Aug 7, 2009 4:03 PM by Donald Hook

    Illegal Syntax for Set Operation

    Donald Hook Newbie
      I created have a seam-gen created app that I am modifying a search page to search on an ID (Integer) rather than a string.  The string search parms work fine, but the numeric ones do not.  For example, I have a list of items, of which I am using the selected item from the list (its id) to search.  I em up getting an Illegal Syntax for Set Operation and am not sure what I am doing wrong.  Any insight would be greatly appreciated. 

      The Stocklist object extends EntityQuery and I have created a string attribute on it (stockList.emptyString) so that 0 is not displayed, otherwise 0 gets passed in for the search criteria.  So if the value is > 0, then display the value, otherwise display an empty string.

      This is the error I receive.

      07:18:15,171 SEVERE [component] /StockList.xhtml @30,146 value="#{ stockList.stock.exchangeId > 0 ? stockList.stock.exchangeId : stockList.emptyString  }": Illegal Syntax for Set Operation

      Thanks .....
        • 1. Re: Illegal Syntax for Set Operation
          Nikos Paraskevopoulos Novice

          The value of an editable component must be a r-value, ie an expression to which values can be assigned to. Is the following legal in Java? That's what you are trying to do.


          (id > 0 ? id : foo.emptyString) = 1234;
          



          One way to mimic the desired functionality is a synthetic property:


          // NOTE: Error handling is left out
          public String getSpecialExchangeId() {
            if( exchangeId == null || exchangeId.intValue() <= 0 ) return "";
            else return exchangeId.toString();
          }
          public void setSpecialExchangeId(String x) {
            Integer newid = new Integer(x);
            if( newid.intValue() > 0 ) exchangeId = newid;
            else exchangeId = null; // or anything appropriate
          }
          



          A more appropriate way would be to implement a standard javax.faces.convert.Converter that implements the desired behavior and register it to the input component.

          • 2. Re: Illegal Syntax for Set Operation
            Nikos Paraskevopoulos Novice

            Nikos Paraskevopoulos wrote on Aug 05, 2009 14:49:


            The value of an editable component must be a r-value,


            ...I mean a l-value...

            • 3. Re: Illegal Syntax for Set Operation
              Donald Hook Newbie

              Nikos -


              Thank you for your feedback.  I tried a converter earlier in the debugging process and came across another error, but will revisit to see if I can get it to work.  I will let you know what the result is.  THANKS!!!

              • 4. Re: Illegal Syntax for Set Operation
                Donald Hook Newbie

                Nikos - I ended up using the synthetic property that you mentioned since the convertNumber did not work since I was trying to display a space for a value that had zero.  I have since implemented a selectOneMenu which works well.  Thanks again for your guidance!