The code I have below filters out the item number for the color red items. The filter Is by size, weight, and height. The results for red are shown in a "text1". In my database the values are Item Number, Size, Weight, Height, and color. (This code works)
import wixData from 'wix-data';
$w.onReady(function () {
});
export function button1_click(event, $w) {
$w('#dataset1').setFilter(wixData.filter()
.eq("color", "red")
.eq("size", $w('#dropdown1').value)
.contains("weight", $w('#dropdown2').value)
.contains("height", $w('#dropdown3').value)
)
$w('#text1').expand();
}
(Currently)
![](https://static.wixstatic.com/media/a27d24_83bf4d500be04ad89494802290c5556b~mv2.png/v1/fill/w_964,h_191,al_c,q_85,enc_auto/a27d24_83bf4d500be04ad89494802290c5556b~mv2.png)
What I would like to do is add another text field where the green colored item numbers are shown when the drop downs are selected and the button is initiated. So after a user selects the drop downs size,weight, and height. The item number will show for red in a "text1" but also show for green in "text2". What do I need to add to my code for the green colored results to be shown?
(What I would like it to be)
![](https://static.wixstatic.com/media/a27d24_3107a66bfbc1482fadf52b0081c399c0~mv2.png/v1/fill/w_968,h_181,al_c,q_85,enc_auto/a27d24_3107a66bfbc1482fadf52b0081c399c0~mv2.png)
Any help will be greatly appreciated!
Hi,
depending on the situation, there are two ways to go about it.
Alternative 1.
If you know the number of alternatives you need (say green and red), you can just add label for everyone and prefill them the same way you do know.
Add another label and another dataset assigning a similar filter based on the same field.
Alternative 2.
This one scales better with the number of options you have.
1) Instead of just using a single label, put that label to the repeater and bind the dataset to the label in the reapeater.
2) Omit the filter for color, so that dataset will get all colors or change the color part from .eq('color', 'red') to list the colors you need .hasSome('color', ['red', 'green'])
This way you can display any number of options fairly easily.
More details:
https://support.wix.com/en/article/about-displaying-database-content-in-a-repeater
Hope this helps.