@madsteer
If i would be you, i would create a DATABASE.
How to do?
- Activate DEV-MODE (developer-mode) in your Wix-Editor.
- Open the following menu in your Wix-Editor.
3) Create a new DATABASE and give it a unique and plausibel NAME / ID.
4) Open the created DATABASE (You will see something like this…)
The database has 2-different modes —> PREVIEW & LIVE (live is when site is published.)
-
Ok, now add 2x new DATA-FIELDS into your DB.
-
Call them index & url (index = 1001 / url = https://www…))
-
Add some values and fill your DATABASE (you can do it first in PREVIEW-MODE).
-
When your DB is completely setted-up for some test-runnings, then you start to search for the right codes, which you will need to code the right functions (search & filter-functions).
-
Ok, let’s see what could match our needs…
a) This looks very good…https://www.wix.com/velo/reference/wix-data/query
Let’s query our DB…
import wixData from 'wix-data';
let myValue
$w.onReady(()=>{
$w('#input1').onChange(()=>{console.log("My value setted!")
myValue=setTimeout(()=>{$w('#input1').value},100);
});
$w('#button1').onClick(()=>{console.log("Button-1 clicked!")
searchIndex(myValue)
});
});
function searchIndex(VALUE){// VALUE = value from your inputfield.
let DATAFIELD = "myDatafieldID" //<put in here the ID of your DATAFIELD (INDEX)
wixData.query("myCollectionID") //<---- put in here the ID of your new DB !
.eq(DATAFIELD, VALUE) //<---- This one is new and will do the filtering !
.find()
.then((results) => {
let items = results.items
if(items.length > 0) {
let myURL = results.items[0].url; console.log(myURL)
wixLocation.to(`${myURL}`);
} else {
// handle case where no matching items found
}
})
}
This function will seach your database for the right value of the inputted index.
You put in an index (“1001”) into the INPUTFIELD.
The function filter the DB for this value and gives you back the corresponding/related value back of URL-DB-FIELD (myURL).
That’s it.
Another way, would be to work with DATASETS, which perhaps could be a much easier way.

