Want to "call" multiple items from database according to user selection. Can you help?

This is the scenario. A website with 35 psychotherapists (database #1), each having selected five (5) specialty areas from among 24 specialties (database #2). I want the user (a potential client visiting the site, looking for the right therapist) to click their area of concern to load a cascade of profiles of therapists who marked that area as a specialty. So “anxiety” might bring up 8 or 10 names (and pictures, addresses, etc), while “sexual dysfunction” might call up only a couple. Conversely, the user might decide to click on each therapist just to see what five areas were that person’s chosen specialties, which is a reverse of the first idea but the same code. Can anyone help here? Thanks.

hi Richard, I’m facing the same situation. how did you manage to solve this?

This example should show you what you are looking for…
https://www.media-junkie.com/pflegeservice

But it will depend on your database-structure. If you use 2 separate DBs, then you have the ability/possibility to “include”…

…or to use “referenced-fields”.

Another scenario could be to have all the data in just one DB.
For example by using TAG-Fields.

EXAMPLE:
Therapist-1: Dr.John Deer (speciality-1, speciality-7, speciality-19, speciality-22)
Therapist-2: Dr.Ken Feer (speciality-2, speciality-3, speciality-5, speciality-9)
Therapist-3: Dr.Ben Beer (speciality-15, speciality-13, speciality-11, speciality-4)

The same structure you can see in this example using ----> Tag-Fields in the DB
And using CheckboxGroups to visualize the DB-Data after doing some filtering processes.
https://www.media-junkie.com/pflegeservice

Is this something you are searching for?

Indeed!
I’ve also checked https://www.wix.com/velo/forum/coding-with-velo/database-filtering-and-grouping-including-caching-of-results

I have 2 DB:
A - includes all users data (dropdown should reference to some of this fields)
B - includes states (that should be included on a dropdown)

Right now I’m not including any reference on the A DB to B, just loading the B list to the dropdown.

How would you advise to structure this?

i would love to include the checkbox group.
Heres what i would like to accomplish.

Dropdown 1 - state
Dropdown 2 - type
Checkbox - Embassy and Ambassadors
Input - checks the description on one of the fields
buscar - a refine search
Ver todos - reset input values

It would be better, if you could show a little excerp of your database (or an example one) how it is structured (DB-A + DB-B). I surely can help you better, when i can see the two DBs (or example DBs) which i could work with.

Hi!

DB A - contains all user information (collected with a form, that user enters data). It holds information about their initiative. This information is displayed later on the repeater from this page (dynamic all, and dynamic item).

All filters should “call” this DB

DB B just contains the states (provincias) that the dropdown (provincias) displays.

Does this help?

Thanks!!!

Take a look again onto this example here…
https://www.media-junkie.com/pflegeservice

This is the working example DB…


Is this what you want to achieve?

By the way! In this example it is NOT NEEDED to create a second DB with all the STATES. The STATES are generated automaticaly in the CheckBox-Group from the INPUT-VALUES in the main-DB.


All you have to do is to load the “PRESET-1” after you have setted-up the DB-PRESET-SETTINGS…but i already did it in this example for you…


You want to show it in REPEATER-VIEW?
Than change the options…

You wanna another repeater-view? Than change repeater-settings from “repeater1” to “repeater2” (2-choices are implemented in this example).

Wanna see how it could work also with SELECTION-TAGS ?
Take a look here…
https://www.media-junkie.com/rd-database-manager

Change the DB-Settings to your own needs… (you have a screenshot of your example-db).


Choose if you want to view it as —> CheckBoxes or Selection-Tags (or DropDowns )

Check also: https://www.wix.com/velo/example/sub-references

https://www.wix.com/velo/reference/wix-data/wixdataquery/include

WOW !!! SOUNDS PERFECT!!!
Brilliant!!!

I guess this :
function SEARCH_ENGINE() {
let filter = wixData.filter()
let item1, item2, item3, item4, item5, item6, item7

connects with the input box?
How do you “connect it”?

Should I take a look at the “Code” or “code upgrade”?

Thank you!!!

Oh BTW, The collection field is populated by the user.
Can users add tags to a collection from a dropdown?
never done that before…

There are 52 states… it can be quite a mess if they are on a checkbox group…

This is what I have accomplished so far…but I’m not sure about the counter and other… would you mind taking a look please?

I cant seem to make it work… :frowning:

Infinite thanks!!!

CB1 - checkbox group
options
Embajadas Embajadores
on DB - as tags

iActividad - dropdown
on DB - as text

iProvincia - dropdown
on DB - as text

reset 1 btn - reset for checkbox group
reset 2 btn - reset for dropdowns
buscarbtn - search btn for dropdowns
buscar2btn - search btn for input field
iBusqueda - input field for search on several fields for a word
seeAll - Ver Todos btn ( see all items)
msgError - no results message

import wixData from ‘wix-data’ ;

import {local} from ‘wix-storage’ ;

//---------------------------------- USER-INTERFACE / настройки ----------------------------------------------------- User-Interface-------------------------------

var DATASET = “#dataset1

//---------------------------------------

var REFERENCE1 = “actividad” ; var MEMORY1

var REFERENCE2 = “provincia” ; var MEMORY2

var REFERENCE3 = “resumen” ; var MEMORY3

var REFERENCE4 = “iniciativa” ; var MEMORY4

var REFERENCE5 = “Colaborador” ; var MEMORY5

var REFERENCE6 = “sobreMi” ; var MEMORY6

var REFERENCE7 = “sobreMi1” ; var MEMORY7

//---------------------------------- USER-INTERFACE / настройки ----------------------------------------------------- User-Interface-------------------------------

var refFields = , myFilter = , MEMORY =

$w.onReady( async function () {

refFields=[REFERENCE1, REFERENCE2, REFERENCE3, REFERENCE4, REFERENCE5, REFERENCE6, REFERENCE7] 

MEMORY[MEMORY1, MEMORY2, MEMORY3, MEMORY4, MEMORY5, MEMORY6, MEMORY7] 



RESET() 

for ( var i = 0 ; i < refFields.length; i++) {

    MEMORY[i] =  **await**  local.getItem(refFields[i]) 

if (MEMORY[i]!== undefined ) {$w( ‘#dataset1’ +(i+ 1 )).value = MEMORY[i], console.log( “MEMORY” + (([i]+ 1 ).toString) + " = " + MEMORY[i])}

} 

//Lokale-Datenabfrage (falls bereits gespeicherte Daten vorhanden sind)…

if (MEMORY1!== undefined ) {$w( ‘#iActividad’ ).value = MEMORY1, console.log( "MEMORY1 = " + MEMORY1)}

if (MEMORY2!== undefined ) {$w( ‘#iProvincia’ ).value = MEMORY2, console.log( "MEMORY2 = " + MEMORY2)}

// if(MEMORY3!==undefined) {$w(‘#DD3’).value = MEMORY3, console.log("MEMORY3 = " + MEMORY3)}

// if(MEMORY4!==undefined) {$w(‘#DD4’).value = MEMORY4, console.log("MEMORY4 = " + MEMORY4)}

// if(MEMORY5!==undefined) {$w(‘#DD5’).value = MEMORY5, console.log("MEMORY5 = " + MEMORY5)}

//const title6 = local.getItem(‘bundesland1’); $w(‘#CB1’).value = title6;

//const title7 = local.getItem(‘sprachen’); $w(‘#CB2’).value = title7;

//const title8 = local.getItem(‘sprachen’); $w(‘#CB21’).value = title8;

//const title9 = local.getItem(‘sprachen’); $w(‘#CB22’).value = title9;

$w( '#CB1' ).options = [ 

{ "label" :  "Embajadores" ,  "value" :  "Embajadores" }, 

{ "label" :  "Embajada" ,  "value" :  "Embajada" }, 


]; 

//DropDown

wixData.query( "Datos Perfil" ) 

.limit( 100 ) 

.find() 

.then(results => { 

const uniqueTitles1 = getUniqueTitles1(results.items);

const uniqueTitles2 = getUniqueTitles2(results.items);

    $w( "#iActividad" ).options = buildOptions1(uniqueTitles1);   //---> ACTIVIDAD 

    $w( "#iProvincia" ).options = buildOptions2(uniqueTitles2);   //---> PROVINCIA 

}); 

function getUniqueTitles1(items) {

const titlesOnly = items.map(item => item[refFields[ 0 ]]);

    return [... **new**  Set(titlesOnly)];} 

function buildOptions1(uniqueList1) {

    return uniqueList1.map(curr => { 

        return {label:curr, value:curr}; 

    }); 

} 

function getUniqueTitles2(items) { const titlesOnly = items.map(item => item[refFields[ 1 ]]); return [… new Set(titlesOnly)];}

function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}

})

//DD1-DD5 = DropDowns------------------------------------------------------

export function iActividad_change(event) {myFilter = myFilter + " / " + $w( ‘#iActividad’ ).value, SEARCH_ENGINE();}

export function iProvincia_change(event) {myFilter = myFilter + " / " + $w( ‘#iProvincia’ ).value, SEARCH_ENGINE();}

export function BuscarBtn_click(event) {SEARCH_ENGINE();}

function SEARCH_ENGINE() {

let filter = wixData.filter()

let item1, item2, item3, item4, item5, item6, item7

//DD1-DD5 = DropDowns------------------------------------------------------

if ($w( ‘#iActividad’ ).value!== “” ) {item1 = $w( ‘#iActividad’ ).value, local.setItem(refFields[ 0 ], $w( ‘#iActividad’ ).value), MEMORY[ 0 ]=local.getItem(refFields[ 0 ]), console.log( "MEMORY1 = " + MEMORY[ 0 ])}

if ($w( ‘#iProvincia’ ).value!== “” ) {item2 = $w( ‘#iProvincia’ ).value, local.setItem(refFields[ 1 ], $w( ‘#iProvincia’ ).value), MEMORY[ 1 ]=local.getItem(refFields[ 1 ]), console.log( "MEMORY2 = " + MEMORY[ 1 ])}

if (item1!== undefined ) {filter = filter.eq(REFERENCE1, item1)}

if (item2!== undefined ) {filter = filter.eq(REFERENCE2, item2)}

if (item3!== undefined ) {filter = filter.eq(REFERENCE3, item3)}

if (item4!== undefined ) {filter = filter.eq(REFERENCE4, item4)}

if (item5!== undefined ) {filter = filter.eq(REFERENCE5, item5)}

//Checkbox-Group-1-----[ Embajadores]----------------------------------------------------

if ($w( ‘#CB1’ ).value[ 0 ]!== undefined ) {item6 = $w( ‘#CB1’ ).value}

if (item6!== undefined ) {console.log( “colaborador-filter activo.” )

for ( var i = 0 ; i < item6.length; i++) {

        filter = filter.eq(REFERENCE5, item6[i]) 

        console.log( "Gewählte-Bundesländer ( "  + i +  " ) = "  + item6[i] ) 

    } 

} 

else {console.log( “Keine Bundesländer ausgewählt” )}

$w(DATASET).setFilter(filter) 

.then(()=>{ 

    console.log(myFilter) 

    $w( "#iBusqueda" ).text = myFilter 

    result_COUNTER() 

    $w( '#iBusqueda' ).refresh(); 

}) 

}

function RESET (parameter) {

$w( "#iActividad" ).selectedIndex =  **undefined** ; 

$w( "#iProvincia" ).selectedIndex =  **undefined** ; 

$w( '#CB1' ).value =  **undefined** ; 


myFilter = [] 

$w( '#iBusqueda' ).text =  "" 

}

//Result-Counter----------------------------------------------

function result_COUNTER() {

let count = $w(DATASET).getTotalCount().toString();

console.log( "COUNT = "  + count) 

$w( '#treffer' ).text = count.toString() 

}

export function notsure!!!(event) { if ($w( ‘#box2’ ).hidden) {$w( ‘#box2’ ).show(), $w( ‘#box4’ ).hide()} else {$w( ‘#box2’ ).hide()}}

export function BTNset_click(event) {$w( ‘#box2’ ).hide(), SEARCH_ENGINE();}

export function BTNset2_click(event) {$w( ‘#box4’ ).hide(), SEARCH_ENGINE();}

//Reset_Buttons----------------------------------------------------------------------------------------

export function BTNreset_click(event) {RESET(), SEARCH_ENGINE();}

export function BTNreset1_click(event) {$w( “#iActividad” ).selectedIndex = undefined , SEARCH_ENGINE();}

export function BTNreset2_click(event) {$w( “#iProvincia” ).selectedIndex = undefined , SEARCH_ENGINE();}

//-----------------------------------------------------------------------------------------------------

export function reset1btn_click(event) {$w( ‘#CB1’ ).value = undefined , SEARCH_ENGINE();}

export function BTNfilterVerlauf_click(event) { if ($w( ‘#box5’ ).hidden) {$w( ‘#box5’ ).show( ‘fade’ )} else {$w( ‘#box5’ ).hide( ‘fade’ )}}

export function BTNclose_click(event) {$w( ‘#box5’ ).hide( ‘fade’ )}

}

hi!
Now Im trying with the not advanced code, and still cant nail it…
Im so embarrased :frowning:

import wixData from ‘wix-data’ ;
import {local} from ‘wix-storage’ ;

//---------------------------------- USER-INTERFACE / настройки ----------------------------------------------------- User-Interface-------------------------------

var DATASET = “#dataset1

//---------------------------------------

var REFERENCE1 = “actividad”
var REFERENCE2 = “provincia”
var REFERENCE3 = “colaborador”
var REFERENCE4 = “verfugbarkeit”
var REFERENCE5 = “ausbildung”
var REFERENCE6 = “bundesland”
var REFERENCE7 = “sprache”

//---------------------------------- USER-INTERFACE / настройки ----------------------------------------------------- User-Interface-------------------------------

var myFilter =

$w.onReady( function () {

//LOCAL DATA

const title1 = local.getItem( ‘actividad’ ); $w( ‘#iActividad’ ).value = title1;
const title2 = local.getItem( ‘provincia’ ); $w( ‘#iProvincia’ ).value = title2;
const title3 = local.getItem( ‘colaborador’ ); $w( ‘#CB1’ ).value = title3;

$w( '#CB1' ).options = [ 

{ "label" :  "Embajadas" ,  "value" :  "Embajadas" }, 
{ "label" :  "Embajadores" ,  "value" :  "Embajadores" }, 

]; 

//DropDown denominación

wixData.query( "Datos Perfil" ) 

.limit( 100 ) 

.find() 

.then(results => { 

const uniqueTitles1 = getUniqueTitles1(results.items);

const uniqueTitles2 = getUniqueTitles2(results.items);

    $w( "#iActividad" ).options = buildOptions1(uniqueTitles1);   //---> ACTIVIDAD 
    $w( "#iProvincia" ).options = buildOptions2(uniqueTitles2);   //---> PROVINCIA 

}); 

function getUniqueTitles1(items) { const titlesOnly = items.map(item => item.anrede); return [… new Set(titlesOnly)];}

function buildOptions1(uniqueList1) {return uniqueList1.map(curr => {return {label:curr, value:curr};});}

function getUniqueTitles2(items) { const titlesOnly = items.map(item => item.nationalitat); return [… new Set(titlesOnly)];}

function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}

})

//DD1-DD5 = DropDowns------------------------------------------------------

export function DD1_change(event) {myFilter = myFilter + " / " + $w( ‘#iActividad’ ).value, SEARCH_ENGINE();}

export function DD2_change(event) {myFilter = myFilter + " / " + $w( ‘#iProvincia’ ).value, SEARCH_ENGINE();}

export function BuscarBtn_click(event) {SEARCH_ENGINE();}

function SEARCH_ENGINE() {

let filter = wixData.filter()

let item1, item2, item3, item4, item5, item6, item7

//DD1-DD5 = DropDowns------------------------------------------------------

if ($w( ‘#iActividad’ ).value!== “” ) {item1 = $w( ‘#iActividad’ ).value}

if ($w( ‘#iProvincia’ ).value!== “” ) {item2 = $w( ‘#iProvincia’ ).value}

if (item1!== undefined ) {filter = filter.eq(REFERENCE1, item1)}

if (item2!== undefined ) {filter = filter.eq(REFERENCE2, item2)}

//Checkbox-Group-1-----[ Bundesländer ]----------------------------------------------------

if ($w( ‘#CB1’ ).value[ 0 ]!== undefined ) {item3 = $w( ‘#CB1’ ).value}

if (item3!== undefined ) {console.log( “colabora activo” )

for ( var i = 0 ; i < item3.length; i++) {

        filter = filter.eq(REFERENCE3, item3[i]) 

        console.log( "Colaboradores ( "  + i +  " ) = "  + item3[i] ) 

    } 

} 

else {console.log( “No se seleccionaron Provincias” )}

$w(DATASET).setFilter(filter) 

.then(()=>{ 

    console.log(myFilter) 

    $w( "#TXTfilter" ).text = myFilter 

    result_COUNTER() 

    $w( '#table1' ).refresh(); 

}) 

}

function RESET (parameter) {

$w( "#iActividad" ).selectedIndex =  **undefined** ; 

$w( "#iProvincia" ).selectedIndex =  **undefined** ; 


$w( '#CB1' ).value =  **undefined** ; 


myFilter = [] 

$w( '#iBusqueda' ).text =  "" 

}

//Result-Counter----------------------------------------------

function result_COUNTER() {

let count = $w(DATASET).getTotalCount().toString();

console.log( "COUNT = "  + count) 

$w( '#treffer' ).text = count.toString() 

}

export function btnCheck_click(event) {

{ if ($w( ‘#box2’ ).hidden) {$w( ‘#box2’ ).show(), $w( ‘#box4’ ).hide()} else {$w( ‘#box2’ ).hide()}}

export function BTNset_click(event) {$w( ‘#box2’ ).hide(), SEARCH_ENGINE();}

export function BTNset2_click(event) {$w( ‘#box4’ ).hide(), SEARCH_ENGINE();}

//Reset_Buttons----------------------------------------------------------------------------------------

export function seeAll_click(event) {RESET(), SEARCH_ENGINE();}

export function reset2btn_click(event) {$w( “#iActividad” ).selectedIndex = undefined , SEARCH_ENGINE();}

export function reset3btn_click(event) {$w( “#iProvincia” ).selectedIndex = undefined , SEARCH_ENGINE();}

//-----------------------------------------------------------------------------------------------------

export function reset1btn_click(event) {$w( ‘#CB1’ ).value = undefined , SEARCH_ENGINE();}

}

Ok, how to recunstruct it ???

What you will need?

  1. You will need to create several -->DropDowns -->with the followind ID-prefix-> " DD "
    EXAMPLE : —> DD1 , DD2 , DD3 , DD4 , DD5 and so on.

  2. You will need to create several -->CheckBoxes -->with ID-prefix-> " CB "
    EXAMPLE : —> CB1 , CB2 , CB3 , CB4 , CB5 and so on.

  3. You will need to add a → Table with the ID —> " table1 "

  4. You will need to add a → DATASET → " dataset1 " & connect it with your Database .
    Connect your DATASET also with your TABLE !

  5. Add a TextField with the ID —> “resultCounter” (this will show RESULTS).

  6. And add this modified and improved CODE here…

  7. Modify parts inside the code like —> USER-INTERFACE-SECTION & REFERENCES

You can add as much DropDowns or Checkboxes as you want, but you also will have to add the new functions inside code (expand the code).

import wixData from 'wix-data';
import {local} from 'wix-storage';

var refFields = [], myFilter = [], MEMORY = []
//var MEMORY1, MEMORY2, MEMORY3, MEMORY4, MEMORY5, MEMORY6, MEMORY7
//--------- USER-INTERFACE / настройки --------------- User-Interface---------------------

var DATASET     = "#dataset1"
var DATABASE    = "Team"
//---------------------------------------
var REFERENCE1  = "anrede" 
var REFERENCE2  = "nationalitat" 
var REFERENCE3  = "berufserfahrung"
var REFERENCE4  = "verfugbarkeit"
var REFERENCE5  = "ausbildung" 
var REFERENCE6  = "bundesland" 
var REFERENCE7  = "sprache" 
//----- USER-INTERFACE / настройки ------------ User-Interface----------------------------
 
$w.onReady(async function () {
    refFields=[REFERENCE1, REFERENCE2, REFERENCE3, REFERENCE4, REFERENCE5, REFERENCE6, REFERENCE7]
 //MEMORY[MEMORY1, MEMORY2, MEMORY3, MEMORY4, MEMORY5, MEMORY6, MEMORY7]
 
//    RESET()
 
//    for (var i = 0; i < refFields.length; i++) {
//        MEMORY[i] = await local.getItem(refFields[i])
//        if(MEMORY[i]!==undefined) {$w('#DD'+(i+1)).value = MEMORY[i]}
//    }
 //Dropdown_Buttons-----------------------------------------------------------------------
    $w('#DD1, #DD2, #DD3, #DD4, #DD5').onChange(()=>{SEARCH_ENGINE();});
 //Checkbox_Buttons-----------------------------------------------------------------------
    $w('#CB1, #CB2, #CB3, #CB4, #CB5').onChange(()=>{SEARCH_ENGINE();});
 //Reset_Buttons--------------------------------------------------------------------------
    $w('#btnReset1').onClick(()=>{$w("#DD1").selectedIndex = undefined, SEARCH_ENGINE();})
    $w('#btnReset2').onClick(()=>{$w("#DD2").selectedIndex = undefined, SEARCH_ENGINE();})
    $w('#btnReset3').onClick(()=>{$w("#DD3").selectedIndex = undefined, SEARCH_ENGINE();})
    $w('#btnReset4').onClick(()=>{$w("#DD4").selectedIndex = undefined, SEARCH_ENGINE();})
    $w('#btnReset5').onClick(()=>{$w("#DD5").selectedIndex = undefined, SEARCH_ENGINE();})
 //Reset_Buttons--------------------------------------------------------------------------
 
 //Lokale-Datenabfrage (falls bereits gespeicherte Daten vorhanden sind)........
//  if(MEMORY1!==undefined) {$w('#DD1').value = MEMORY1, console.log("MEMORY1 = " + MEMORY1)}
//  if(MEMORY2!==undefined) {$w('#DD2').value = MEMORY2, console.log("MEMORY2 = " + MEMORY2)}
//  if(MEMORY3!==undefined) {$w('#DD3').value = MEMORY3, console.log("MEMORY3 = " + MEMORY3)}
//  if(MEMORY4!==undefined) {$w('#DD4').value = MEMORY4, console.log("MEMORY4 = " + MEMORY4)}
//  if(MEMORY5!==undefined) {$w('#DD5').value = MEMORY5, console.log("MEMORY5 = " + MEMORY5)}
 
 //const title6 = local.getItem('bundesland1');      $w('#CB1').value = title6;
 //const title7 = local.getItem('sprachen');         $w('#CB2').value = title7;
 //const title8 = local.getItem('sprachen');         $w('#CB21').value = title8;
 //const title9 = local.getItem('sprachen');         $w('#CB22').value = title9;
 
 //Options for CheckBox-1------------------------------
    $w('#CB1').options = [
    {"label": "Burgenland", "value": "Burgenland"},
    {"label": "Kärnten", "value": "Kärnten"},
    {"label": "Niederösterreich", "value": "Niederösterreich"},
    {"label": "Oberösterreich", "value": "Oberösterreich"},
    {"label": "Salzburg", "value": "Salzburg"},
    {"label": "Steiermark", "value": "Steiermark"},
    {"label": "Tirol", "value": "Tirol"},
    {"label": "Vorarlberg", "value": "Vorarlberg"},
    {"label": "Wien", "value": "Wien"},
    ];

 //Options for CheckBox-2------------------------------
    $w('#CB2').options = [
        {"label": "Englisch",       "value": "Englisch"},
        {"label": "Estnisch",       "value": "Estnisch"},
        {"label": "Finnisch",       "value": "Finnisch"},
        {"label": "Französisch",    "value": "Französisch"},
        {"label": "Deutsch",        "value": "Deutsch"},
        {"label": "Italienisch",    "value": "Italienisch"},
        {"label": "Rumänisch",      "value": "Rumänisch"},
        {"label": "Russisch",       "value": "Russisch"},
        {"label": "Schwedisch",     "value": "Schwedisch"},
        {"label": "Spanisch",       "value": "Spanisch"},
    ];
 
 
 //DropDown-Benennung....(Betitelung)
    wixData.query(DATABASE)
    .limit(100)
    .find()
    .then(results => {
 const uniqueTitles1 = getUniqueTitles1(results.items);
 const uniqueTitles2 = getUniqueTitles2(results.items);
 const uniqueTitles3 = getUniqueTitles3(results.items);
 const uniqueTitles4 = getUniqueTitles4(results.items);
 const uniqueTitles5 = getUniqueTitles5(results.items);
 
        $w("#DD1").options = buildOptions1(uniqueTitles1);  //---> STATUS
        $w("#DD2").options = buildOptions2(uniqueTitles2);  //---> ANREDE
        $w("#DD3").options = buildOptions3(uniqueTitles3);  //---> NATIONALITÄT
        $w("#DD4").options = buildOptions4(uniqueTitles4);  //---> VERFÜGBARKEIT
        $w("#DD5").options = buildOptions4(uniqueTitles5);  //---> AUSBILDUNG
    });
 
 function getUniqueTitles1(items)    {
 const titlesOnly = items.map(item => item[refFields[0]]);   
        return [...new Set(titlesOnly)];}
 function buildOptions1(uniqueList1) {
        return uniqueList1.map(curr => {
            return {label:curr, value:curr};
        });
    }
 
 function getUniqueTitles2(items)    {const titlesOnly = items.map(item => item[refFields[1]]);  return [...new Set(titlesOnly)];}
 function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}
 
 function getUniqueTitles3(items)    {const titlesOnly = items.map(item => item[refFields[2]]);  return [...new Set(titlesOnly)];}
 function buildOptions3(uniqueList3) {return uniqueList3.map(curr => {return {label:curr, value:curr};});}
 
 function getUniqueTitles4(items)    {const titlesOnly = items.map(item => item[refFields[3]]);  return [...new Set(titlesOnly)];}
 function buildOptions4(uniqueList4) {return uniqueList4.map(curr => {return {label:curr, value:curr};});}
 
 function getUniqueTitles5(items)    {const titlesOnly = items.map(item => item[refFields[4]]);  return [...new Set(titlesOnly)];}
 function buildOptions5(uniqueList5) {return uniqueList5.map(curr => {return {label:curr, value:curr};});}
})
 
export function BTNsearch_click(event)  {SEARCH_ENGINE();}
 
function SEARCH_ENGINE() {console.log("Search-Engine started")
 let filter =  wixData.filter()  
 let item1, item2, item3, item4, item5, item6, item7
 
 //DD1-DD5 = DropDowns------------------------------------------------------
 if ($w('#DD1').value!=="")  {item1 = $w('#DD1').value, local.setItem(refFields[0], $w('#DD1').value)} //, MEMORY[0]=local.getItem(refFields[0])}
 if ($w('#DD2').value!=="")  {item2 = $w('#DD2').value, local.setItem(refFields[1], $w('#DD2').value)} //, MEMORY[1]=local.getItem(refFields[1])}
 if ($w('#DD3').value!=="")  {item3 = $w('#DD3').value, local.setItem(refFields[2], $w('#DD3').value)} //, MEMORY[2]=local.getItem(refFields[2])}
 if ($w('#DD4').value!=="")  {item4 = $w('#DD4').value, local.setItem(refFields[3], $w('#DD4').value)} //, MEMORY[3]=local.getItem(refFields[3])}
 if ($w('#DD5').value!=="")  {item5 = $w('#DD5').value, local.setItem(refFields[4], $w('#DD5').value)} //, MEMORY[4]=local.getItem(refFields[4])}
 
 if (item1!==undefined)      {filter = filter.eq(REFERENCE1, item1)}
 if (item2!==undefined)      {filter = filter.eq(REFERENCE2, item2)}
 if (item3!==undefined)      {filter = filter.eq(REFERENCE3, item3)}
 if (item4!==undefined)      {filter = filter.eq(REFERENCE4, item4)}
 if (item5!==undefined)      {filter = filter.eq(REFERENCE5, item5)}
 //DD1-DD5 = DropDowns------------------------------------------------------
 
 //Checkbox-Group-1-----[ Bundesländer ]------------------------------------------------
 if ($w('#CB1').value[0]!==undefined)  {item6 = $w('#CB1').value}
 if (item6!==undefined)  {console.log("Bundesland-filter aktiv.")    
 for (var i = 0; i < item6.length; i++) {
            filter = filter.eq(REFERENCE6, item6[i])
            console.log("Gewählte-Bundesländer ( " + i + " ) = " + item6[i] )
        }
    }
 else {console.log("Keine Bundesländer ausgewählt")}
 
 
 //Checkbox-Group-2-----[Sprachen ]----------------------------------------------------
 if ($w('#CB2').value[0]!==undefined)  {item7 = $w('#CB2').value}
 if (item7!==undefined)  {console.log("Sprachen-filter aktiv.")  
 for (var a = 0; a < item7.length; a++) {
            filter = filter.eq(REFERENCE7, item7[a])
            console.log("Gewählte-Sprachen ( " + a + " ) = " + item7[a] )
        }
    }
 else {console.log("Keine Bundesländer ausgewählt")}
 
    $w(DATASET).setFilter(filter)
    .then(()=>{
        console.log(myFilter)
        result_COUNTER()
        $w('#table1').refresh();
    })
}
 
function RESET (parameter) {
    $w("#DD1").selectedIndex = undefined;
    $w("#DD2").selectedIndex = undefined;
    $w("#DD3").selectedIndex = undefined;
    $w("#DD4").selectedIndex = undefined;
    $w("#DD5").selectedIndex = undefined;
    $w('#CB1').value = undefined;
    $w('#CB2').value = undefined;
    myFilter = []
}


//Result-Counter----------------------------------------------
function result_COUNTER() {
 let count = $w(DATASET).getTotalCount().toString();
    console.log("COUNT = " + count)
    $w('#resultCounter').text = count.toString()
} 

A working example, which i created within about 15min you will find here…
https://www.media-junkie.com/filter-test


But this version is a pure DATASET-VERSION, and differs totaly from the the shown VERSION on this site…
https://www.media-junkie.com/pflegeservice

Let us tell the DATASET-VERSION —> the light version (Disabled Memory-Function & NO other functionalities).

Everything else you can see inside the code.

Now you should be able to reconstruct this example.

SOME EXTRA: To improve this little FILTER-PROJECT you could take a look onto this post.


All related DATABASES which are given in this example you will find here…
https://www.media-junkie.com/databases
Try to change DATABASE-SETTINGS and choose another DATABASE from given DATABASE-POOL. (“Team” / “Real-Estate” / “Worlds-Presidents” / “Skole” / “Courses” / “Salon-Village” / “Initiatives” / …and so on…)

To get the right Field-IDs of each DATABASE, take a look onto the given DB-Pics, or click in the RD-Data-Manager-Version…(after you have sette-up the Preset-Settings)
https://www.media-junkie.com/rd-database-manager
…onto


…a new menu will open…


…click on —> “Export-Data” and see what happens. Now you should be able to see all DATA-Field-IDs of the current DATABASE which you have selected.
Now you are able to fill the preset-settigs (dropdowns/selection-tags & checkboxes).

Example:
If you select a DATABASE which is not existing you wil get an ERROR.
For example: The database called —> “xxxx” is NOT-EXISTING in this interactive example.

Result: After you have saved and load again the current DB-Preset, you should get an ERROR-MESSAGE (which tells you → DATABAS do not exist).

BTW: Sorry for —> any ERRORs in my tool —> it’s still in developement :grin::sweat_smile::sweat_smile::sweat_smile:

Hi @russian-dima !!!
Thank you for your explanation!!!
your tool is awesome!!!

I’ve checked the links you provided. they are great!
yet,not sure I cant make it work on my site :frowning:

Some notes:
CB1 -connected to dataset1 - value “Colaborador (tags)”
yet it’s not displaying the options nor narrowing the search :frowning:

I’ve changed the # to match DD1 and so on.
not sure why nothing is working :((((((((

I’ve included the code Im using.
help !

import wixData from ‘wix-data’ ;
import {local} from ‘wix-storage’ ;

var refFields = , myFilter = , MEMORY =
//var MEMORY1, MEMORY2, MEMORY3, MEMORY4, MEMORY5, MEMORY6, MEMORY7
//--------- USER-INTERFACE / настройки --------------- User-Interface---------------------

var DATASET = “#dataset1
//---------------------------------------
var REFERENCE1 = “actividad”
var REFERENCE2 = “provincia”
var REFERENCE3 = “colaborador”

//----- USER-INTERFACE / настройки ------------ User-Interface----------------------------

$w.onReady( async function () {
refFields=[REFERENCE1, REFERENCE2, REFERENCE3]
//MEMORY[MEMORY1, MEMORY2, MEMORY3, MEMORY4, MEMORY5, MEMORY6, MEMORY7]

// RESET()

// for (var i = 0; i < refFields.length; i++) {
// MEMORY[i] = await local.getItem(refFields[i])
// if(MEMORY[i]!==undefined) {$w(‘#DD’+(i+1)).value = MEMORY[i]}
// }
//Dropdown_Buttons-----------------------------------------------------------------------
$w( ‘#DD1, #DD2’ ).onChange(()=>{SEARCH_ENGINE();});
//Checkbox_Buttons-----------------------------------------------------------------------
$w( ‘#CB1’ ).onChange(()=>{SEARCH_ENGINE();});
//Reset_Buttons--------------------------------------------------------------------------
$w( ‘#btnReset1’ ).onClick(()=>{$w( “#DD1” ).selectedIndex = undefined , SEARCH_ENGINE();})
$w( ‘#btnReset2’ ).onClick(()=>{$w( “#DD2” ).selectedIndex = undefined , SEARCH_ENGINE();})

//Reset_Buttons--------------------------------------------------------------------------

//Lokale-Datenabfrage (falls bereits gespeicherte Daten vorhanden sind)…
// if(MEMORY1!==undefined) {$w(‘#DD1’).value = MEMORY1, console.log("MEMORY1 = " + MEMORY1)}
// if(MEMORY2!==undefined) {$w(‘#DD2’).value = MEMORY2, console.log("MEMORY2 = " + MEMORY2)}
// if(MEMORY3!==undefined) {$w(‘#DD3’).value = MEMORY3, console.log("MEMORY3 = " + MEMORY3)}
// if(MEMORY4!==undefined) {$w(‘#DD4’).value = MEMORY4, console.log("MEMORY4 = " + MEMORY4)}
// if(MEMORY5!==undefined) {$w(‘#DD5’).value = MEMORY5, console.log("MEMORY5 = " + MEMORY5)}

//const title6 = local.getItem(‘bundesland1’); $w(‘#CB1’).value = title6;
//const title7 = local.getItem(‘sprachen’); $w(‘#CB2’).value = title7;
//const title8 = local.getItem(‘sprachen’); $w(‘#CB21’).value = title8;
//const title9 = local.getItem(‘sprachen’); $w(‘#CB22’).value = title9;

//Options for CheckBox-1------------------------------
$w( ‘#CB1’ ).options = [
{ “label” : “Embajadores” , “value” : “Embajador” },
{ “label” : “Embajadas” , “value” : “Embajada” },
];

//DropDown-Benennung…(Betitelung)
wixData.query( “Datos Perfil” )
.limit( 100 )
.find()
.then(results => {
const uniqueTitles1 = getUniqueTitles1(results.items);
const uniqueTitles2 = getUniqueTitles2(results.items);

    $w( "#DD1" ).options = buildOptions1(uniqueTitles1);   //---> ACTIVIDAD 
    $w( "#DD2" ).options = buildOptions2(uniqueTitles2);   //---> PROVINCIA 

}); 

function getUniqueTitles1(items) {
const titlesOnly = items.map(item => item[refFields[ 0 ]]);
return [… new Set(titlesOnly)];}
function buildOptions1(uniqueList1) {
return uniqueList1.map(curr => {
return {label:curr, value:curr};
});
}

function getUniqueTitles2(items) { const titlesOnly = items.map(item => item[refFields[ 1 ]]); return [… new Set(titlesOnly)];}
function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}

})

export function BuscarBtn_click(event) {SEARCH_ENGINE();}

function SEARCH_ENGINE() {console.log( “Search-Engine started” )
let filter = wixData.filter()
let item1, item2, item3

//DD1-DD5 = DropDowns------------------------------------------------------
if ($w( ‘#DD1’ ).value!== “” ) {item1 = $w( ‘#DD1’ ).value, local.setItem(refFields[ 0 ], $w( ‘#DD1’ ).value)} //, MEMORY[0]=local.getItem(refFields[0])}
if ($w( ‘#DD2’ ).value!== “” ) {item2 = $w( ‘#DD2’ ).value, local.setItem(refFields[ 1 ], $w( ‘#DD2’ ).value)} //, MEMORY[1]=local.getItem(refFields[1])}

if (item1!== undefined ) {filter = filter.eq(REFERENCE1, item1)}
if (item2!== undefined ) {filter = filter.eq(REFERENCE2, item2)}

//DD1-DD5 = DropDowns------------------------------------------------------

//Checkbox-Group-1-----[ Bundesländer ]------------------------------------------------
if ($w( ‘#CB1’ ).value[ 0 ]!== undefined ) {item3 = $w( ‘#CB1’ ).value}
if (item3!== undefined ) {console.log( “Bundesland-filter aktiv.” )
for ( var i = 0 ; i < item3.length; i++) {
filter = filter.eq(REFERENCE3, item3[i])
console.log( "Gewählte-Bundesländer ( " + i + " ) = " + item3[i] )
}
}
else {console.log( “Keine Bundesländer ausgewählt” )}

$w(DATASET).setFilter(filter) 
.then(()=>{ 
    console.log(myFilter) 
    result_COUNTER() 
    $w( '#table1' ).refresh(); 
}) 

}

function RESET (parameter) {
$w( “#DD1” ).selectedIndex = undefined ;
$w( “#DD2” ).selectedIndex = undefined ;

$w( '#CB1' ).value =  **undefined** ; 

myFilter = [] 

}

//Result-Counter----------------------------------------------
function result_COUNTER() {
let count = $w(DATASET).getTotalCount().toString();
console.log( "COUNT = " + count)
$w( ‘#resultCounter’ ).text = count.toString()
}

/**

  • Adds an event handler that runs when an input element’s value
    is changed.
  • @param {$w.Event} event

First at all, please change your postet codes and put them into CODE-Blocks, like i do it here…

import wixData from 'wix-data';

var refFields = [], MEMORY = []
//--------- USER-INTERFACE / настройки --------------- User-Interface---------------------

var DATASET     = "#dataset1"
var DATABASE    = "Datos Perfil"
//---------------------------------------
var REFERENCE1  = "actividad" //-> ID of one collection-field (columns in your collection)
var REFERENCE2  = "provincia" //-> ID of one collection-field (columns in your collection)
var REFERENCE3  = "colaborador"//-> ID of one collection-field (column in your collection)
//----- USER-INTERFACE / настройки ------------ User-Interface----------------------------
 
$w.onReady(async function () {
    refFields=[REFERENCE1, REFERENCE2, REFERENCE3]
 //Dropdown_Buttons-----------------------------------------------------------------------
    $w('#DD1, #DD2').onChange(()=>{SEARCH_ENGINE();});
 //Checkbox_Buttons-----------------------------------------------------------------------
    $w('#CB1').onChange(()=>{SEARCH_ENGINE();});
 //Reset_Buttons--------------------------------------------------------------------------
    $w('#btnReset1').onClick(()=>{$w("#DD1").selectedIndex = undefined, SEARCH_ENGINE();})
    $w('#btnReset2').onClick(()=>{$w("#DD2").selectedIndex = undefined, SEARCH_ENGINE();})
 
 
 //Options for CheckBox-1------------------------------
    $w('#CB1').options = [
        {"label": "Embajadores",    "value": "Embajador"},
        {"label": "Embajadas",      "value": "Embajada"},
    ];
 
 //Create-Unique-Dropdown-------------------------------------------------
    wixData.query(DATABASE)
    .limit(1000)
    .find()
    .then(results => {
 const uniqueTitles1 = getUniqueTitles1(results.items);
 const uniqueTitles2 = getUniqueTitles2(results.items);
        $w("#DD1").options = buildOptions1(uniqueTitles1);  //---> ACTIVIDAD
        $w("#DD2").options = buildOptions2(uniqueTitles2);  //---> PROVINCIA
    });
 
 //-------------
 function getUniqueTitles1(items)    {const titlesOnly = items.map(item => item[refFields[0]]); return [...new Set(titlesOnly)];}
 function buildOptions1(uniqueList1) {return uniqueList1.map(curr => {return {label:curr, value:curr};});}
 //-------------
 function getUniqueTitles2(items)    {const titlesOnly = items.map(item => item[refFields[1]]);  return [...new Set(titlesOnly)];}
 function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}
 //-------------
})
 
export function BuscarBtn_click(event)  {SEARCH_ENGINE();}
 
function SEARCH_ENGINE() {console.log("Search-Engine started")
 let filter =  wixData.filter()  
 let item1, item2, item3

 //DD1-DD5 = DropDowns------------------------------------------------------
 if ($w('#DD1').value!=="")  {
    item1 = $w('#DD1').value, local.setItem(refFields[0], $w('#DD1').value)
 }
 if ($w('#DD2').value!=="")  {
    item2 = $w('#DD2').value, local.setItem(refFields[1], $w('#DD2').value)
 }
 
 if (item1!==undefined)      {filter = filter.eq(REFERENCE1, item1)}
 if (item2!==undefined)      {filter = filter.eq(REFERENCE2, item2)}

 //DD1-DD5 = DropDowns------------------------------------------------------
 
 //Checkbox-Group-1-----[ Bundesländer ]------------------------------------------------
 if ($w('#CB1').value[0]!==undefined)  {item3 = $w('#CB1').value}
 if (item3!==undefined)  {
 for (var i = 0; i < item3.length; i++) {filter = filter.eq(REFERENCE3, item3[i])}
    }
 else {}

    $w(DATASET).setFilter(filter)
    .then(()=>{
        result_COUNTER()
        $w('#table1').refresh();
    })
}
 
function RESET (parameter) {
    $w("#DD1").selectedIndex = undefined;
    $w("#DD2").selectedIndex = undefined;
    $w('#CB1').value = undefined;
}


//Result-Counter----------------------------------------------
function result_COUNTER() {
 let count = $w(DATASET).getTotalCount().toString();
    console.log("COUNT = " + count)
    $w('#resultCounter').text = count.toString()
} 

Check the following check-points:

  1. Did you gave all dropDwons the right ID?
  2. Did you gave all the CheckBoxes the right ID?
  3. Did you connect your DATASET with TABLE and with DATABASE?
  4. Is the order of PREFERENCES right (DropDowns & CheckBoxes)?
  5. Is the ID of your entered collection right?

Normaly the code looks good.

Hi @russian-dima !

Thank you for all the hard work!!

Heres what I’ve done…
Ive erased every single item and reconstructed the page again.

  1. Did you gave all dropDwons the right ID? - done
  2. Did you gave all the CheckBoxes the right ID? - Its just one checkbox - done
  3. Did you connect your DATASET with TABLE and with DATABASE? - done
  4. Is the order of PREFERENCES right (DropDowns & CheckBoxes)? - not sure what you mean here.
  5. Is the ID of your entered collection right? - yes- #dataset1

Heres whats happening… :frowning:

The Collection is in the editor.

WDE0025: The Datos Perfil collection does not exist. You cannot work with a collection using the Data API before it is created in the Editor.

local is not defined

Datos Perfil (All)
Line 62

Im trying to upload a snapshot,but it doesn’t load :frowning:

Ill try in a while

This is exactly what i was asking for…

WDE0025: The Datos Perfil collection does not exist. You cannot work with a collection using the Data API before it is created in the Editor.

  1. Is the ID of your entered collection right? - yes- #dataset1

Datacollection is not the dataset.
DATASET = dataset1 —> ok.
COLLECTION-ID = ??? (DATABASE-ID = ?)

The DATASET is connected to your COLLECTION/DATABASE.

If you check my last modification again in the “USER-INTERFACE”…

//--------- USER-INTERFACE / настройки --------------- User-Interface-------------
var DATASET     = "#dataset1"
var DATABASE    = "Datos Perfil"
//---------------------------------------
var REFERENCE1  = "actividad" 
var REFERENCE2  = "provincia"
var REFERENCE3  = "colaborador"
//----- USER-INTERFACE / настройки ------------ User-Interface--------------------

…you will see DATASET & DATABASE.
Please check the entered ID of the DATABASE —> “Datos Perfil”
If it is the right ID (not just the name).

How to check if your Database has the right ID?
-Go to the options of the current DATABASE…

Hi @russian-dima !
I’ve noticed that the blank space was the issue.
Thank you very much for your clarification!!! You are awesome!!!

So now I’ve changed it to “DatosPerfil” instead of “Datos Perfil”…
I’ve also checked the field’s key in the collection, and they match.
And… it still doesnt work…

I’m about to give up :frowning: