Hi Support,
We are looking to use query builder control in our application. In our scenario we need to add sub-query in condition, so wondering if it is possible to do it in query builder?
If possible can we get any sample code or article reference to add sub query in query builder conditions?
Regards,
Awais
this.fieldMode = 'DropdownTree';
this.separator = '.';
this.columns = [
{ field: 'Employee', label: 'Employee', columns: [
{ field: 'ID', label: 'ID', type: 'number' },
{ field: 'DOB', label: 'Date of birth', type: 'date', format: 'yMd' },
{ field: 'HireDate', label: 'Hire Date', type: 'date' },
{ field: 'Salary', label: 'Salary', type: 'number' },
{ field: 'Age', label: 'Age', type: 'number' },
{ field: 'Title', label: 'Title', type: 'string' }
] },
{ field: 'Name', label: 'Name', columns: [
{ field: 'FirstName', label: 'First Name', type: 'string' },
{ field: 'LastName', label: 'Last Name', type: 'string' }
] },
{ field: 'Country', label: 'Country', columns: [
{ field: 'State', label: 'State', columns: [
{ field: 'City', label: 'City', type: 'string' },
{ field: 'Zipcode', label: 'Zip Code', type: 'number' }
] },
{ field: 'Region', label: 'Region', type: 'string' },
{ field: 'Name', label: 'Name', type: 'string' }
] }
];
this.importRules = {
'condition': 'and',
'rules': [{
'label': 'ID',
'field': 'Employee.ID',
'type': 'number',
'operator': 'equal',
'value': 1001
},
{
'label': 'First Name',
'field': 'Name.FirstName',
'type': 'string',
'operator': 'equal',
'value': 'Mark'
},
{
'condition': 'or',
'rules': [{
'label': 'City',
'field': 'Country.State.City',
'operator': 'equal',
'type': 'string',
'value': 'Jersey City'
}, {
'label': 'Date of birth',
'field': 'Employee.DOB',
'operator': 'equal',
'type': 'date',
'value': '7/7/96'
}]
}
]
};
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<div className='col-lg-12 control-section'>
<QueryBuilderComponent dataSource={complexData} columns={this.columns} rule={this.importRules}
fieldMode={this.fieldMode} separator={this.separator}>
</QueryBuilderComponent>
</div>
</div>
</div>);
}
|