Hi @jede04 , welcome to the KNIME community!
It feels to me that the issue here isn’t so much one of manipulation of the multi selection config, but more how to specify what the chosen options mean, and how to identify which options are “category” and which are “sub-category”.
(I see @aliasghar_marvi has replied while I’ve been thinking about this, and the observation that ideally this would be performed with multiple cascading widgets is reasonable, but I’ll continue
)
If this were being built as a component, a pair of multi-selection list boxes, one with each might also make sense in this regard. But again, I’ll continue with it being the one selection box.
As you have noted, the list will just grow exponentially as more options are added, so irrespective of the mechanics of how the selection is being made, something needs to change in how to build the query… ![:wink: :wink:](https://forum-cdn.knime.com/images/emoji/twitter/wink.png?v=12)
Is it reasonable to say that if you chose categories X1, X2,… Xn and sub-categories Y1, Y2,… Yn , the query to be built should be:
AND ( Category IN (X1, X2,… Xn) or SubCategory in (Y1, Y2,… Yn) )
If so, then what you could do is divide out the selections that are for category and those which are for subcategory.
The attached workflow is built as a component for testing (which you can open to see the logic)
Within the component, a table of selectable options is created which defines whether an item is a category or subcategory
The first column of this table is turned into a variable that becomes the selectable options in the config node.
Once selected, the selection options string is turned back into a table of values and joined to the original options table to determine which are categories and which are subcategories.
These are then split out and processed individually to create the respective conditions for each, and then merged into a single variable that is returned.
Build Query from selected options.knwf (44.3 KB)
It includes “1=0” as a placeholder for no value being selected for one of the types, this is more convenient than additional logic to change the general construction of the conditional query according to whether any category or subcategory has been chosen, but can be safely included as it always returns false, so doesn’t affect the result.