public static void addParameterSortBy( QueryDefinition queryDefn, AbstractScalarParameterHandle parameter, IModelAdapter adapter) { String sortBy = parameter.getSortByColumn(); if (sortBy != null) { String sortDirection = parameter.getSortDirection(); if (sortDirection != null) { org.eclipse.birt.report.model.api.Expression mexpr = (org.eclipse.birt.report.model.api.Expression) parameter .getExpressionProperty(AbstractScalarParameter.SORT_BY_COLUMN_PROP) .getValue(); ScriptExpression dexpr = adapter.adaptExpression(mexpr); SortDefinition sort = new SortDefinition(); sort.setExpression(dexpr); boolean direction = DesignChoiceConstants.SORT_DIRECTION_ASC.equalsIgnoreCase(sortDirection); sort.setSortDirection(direction ? ISortDefinition.SORT_ASC : ISortDefinition.SORT_DESC); queryDefn.addSort(sort); } } }