// ControlRow CurControlRow;
// getfilterstate();
int nFilterCount = getFilterCount();
if (nFilterCount > 0)
{
final SQLQueryComposer composer = oQueryMetaData.getSQLQueryComposer();
try
{
final String serviceName = "com.sun.star.beans.PropertyBag";
final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));
column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR);
column.addProperty("Name", PropertyAttribute.BOUND, "");
column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), null );
final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column);
if ( composer.getQuery().length() == 0)
{
final String fromClause = composer.getFromClause();
StringBuilder sql = new StringBuilder();
sql.append(composer.getSelectClause(true));
sql.append(' ');
sql.append(fromClause);
composer.getQueryComposer().setElementaryQuery(sql.toString());
}
composer.getQueryComposer().setStructuredFilter( new PropertyValue[][] {} );
for (int i = 0; i < RowCount; i++)
{
ControlRow currentControlRow = oControlRows[i];
if (currentControlRow.isEnabled())
{
if (currentControlRow.isConditionComplete())
{
String sFieldName = currentControlRow.getSelectedFieldName();
int nOperator = (int) currentControlRow.getSelectedOperator();
FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
columnSet.setPropertyValue("Name", aFieldColumn.getFieldName());
columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
Object value = currentControlRow.getValue();
switch(aFieldColumn.getFieldType())
{
case DataType.TIMESTAMP:
case DataType.DATE:
value = ((Double)value) - oQueryMetaData.getNullDateCorrection();
break;
}
column.removeProperty( "Value" );
final short operator = currentControlRow.getSelectedOperator();
if ( ( operator == SQLFilterOperator.SQLNULL )
|| ( operator == SQLFilterOperator.NOT_SQLNULL )
|| AnyConverter.isVoid( value )
)
{
column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), new String() );
value = new Any( new Type( TypeClass.VOID ), null );
}
else
column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), value );
columnSet.setPropertyValue("Value", value);
composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator);
}
}
}
filterconditions = composer.getNormalizedStructuredFilter();
int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
if (iduplicate[0] != -1)
{
PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]];
String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null);