Variable must provide either dimension expressions or an array initializer--ErroR
<p>For testing purposes I harded coded a bean array so I can pass variables to the database.  I'm now pulling the variables from a form and want to set them in the bean array if they are not null.  I assume Im formatting it wrong.</p>

<p>Hardcode:</p>

<pre><code>DetFilterCriteriaBean[] filters = new DetFilterCriteriaBean[]
{
    new DetFilterCriteriaBean("WORKLOAD_YEAR","=","2012"),
    new DetFilterCriteriaBean("SOURCE_OF_REPAIR","in","('MCA','MCB')"),
    new DetFilterCriteriaBean("TAMCN","is","not null") 
};
</code></pre>

<p>I was trying to do something like this and got the error:</p>

<pre><code> DetFilterCriteriaBean[] filters = new DetFilterCriteriaBean[]
           {
            if (form.getWySelect() != null) 
            {   
            new DetFilterCriteriaBean("WORKLOAD_YEAR","=","2012")
            }


           };
</code></pre>

<p>DetFilterCriteriaBean</p>

<pre><code>public class DetFilterCriteriaBean
extends AbstractBean
{
public static final DetFilterCriteriaBean[] EMPTY_ARRAY = new DetFilterCriteriaBean[0];

private String fieldName;
private String operation;
private String value;

public DetFilterCriteriaBean() { } 
public DetFilterCriteriaBean( String field, 
                              String op, 
                              String val ) 
{
   this.fieldName = field; 
   this.operation = op;
   this.value = val;
}



public String getFieldName() { return this.fieldName; }
public String getOperation() { return this.operation; }
public String getValue() { return this.value; }

public void setFieldName(String val) { this.fieldName = val; }
public void setOperation(String val) { this.operation = val; }
public void setValue(String val) { this.value = val; }

public String toString() 
{
    return "{ " + getFieldName() + " " + getOperation() + " " + getValue() + " }";
}
</code></pre>

<p>Is there a better way to do this??</p>
