Dec 21, 20225:04 AM - edited Dec 21, 20227:25 AM
Contributor | Elite Partner
Graphql how to filter on hubdb select column
Hi,
I want to filter on hubdb select column: product and onderwerp:
And because it is a select column do i have to put this: $product.value ?
If i dont use a variable and place hardcoded a value the filter works. But i want it based on a hubdb multi select column.
Code:
# label: "Downloads listing"
# description: "Query that retrieves and filters downloads in different ways. When filtering by company we need to find the company first and then fetch its associated downloads. We use the directives and @include to control which query will run. The last two queries fetch the values we use for generating the filtering options in the UI."
# $offset: {{ request.query_dict.offset || 0 }}
# $limit: {{ (module.cards_per_row * module.rows_per_page) || 5 }}
# $product: {{ request.query_dict.product || '' }}
# $onderwerp: {{ request.query_dict.onderwerp || '' }}
query downloads_listing(
$offset: Int,
$limit: Int,
$product_name: [HS_Enum],
$onderwerp_text: [HS_Enum] )
{
HUBDB {
# Gets vacatures when there is either no filtering, or we're filtering by location and/or department.
downloads_filter: downloads_collection(limit: $limit, offset: $offset, filter: {product__eq: $product, onderwerp__eq: $onderwerp}) {
items {
name
url
}
hasMore
limit
offset
total
}
downloads_dropdown_values: downloads_collection {
items {
product
onderwerp
datum
}
}
}
}