GitHub user dosubot[bot] added a comment to the discussion: what exactly does 
it mean filters

<!-- Answer -->
The `adhoc_filters` property in the `formData` object should be an array of 
objects, each with a specific structure. Here's the expected structure for an 
`adhoc_filter` object:

```typescript
{
  clause: string,
  expressionType: string,
  operator: string | null,
  subject: string | null,
  comparator: string | string[] | number | null,
  sqlExpression?: string | null,
  filterOptionName: string,
  operatorId?: string,
  isExtra?: boolean,
  datasourceWarning?: boolean,
  isNew?: boolean,
}
```

In your code, you need to ensure that the `adhocFilterNEW` object matches this 
structure. You are missing the `expressionType` and `filterOptionName` 
properties, which are required. Here's how you can define `adhocFilterNEW`:

```typescript
const adhocFilterNEW = {
  clause: 'WHERE',
  expressionType: 'SIMPLE', // Example value, adjust as needed
  operator: '=',
  subject: 'my_subject',  // Your column name
  comparator: level_column, // Change this to the actual column name in your 
dataset
  filterOptionName: 'filter_option_name', // Example value, adjust as needed
};
```

Make sure to replace `'SIMPLE'` and `'filter_option_name'` with appropriate 
values based on your use case. After defining the filter correctly, you can add 
it to the `adhoc_filters` array in `formData` as you are doing in your 
`buildQuery` function 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/explore/controlUtils/getFormDataFromDashboardContext.test.ts)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonFilters.test.ts)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*

---
<sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/28917eb3-da72-40b5-afea-d9a9987165a9?feedback_type=other)</sup>


GitHub link: 
https://github.com/apache/superset/discussions/33402#discussioncomment-13102245

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to