I have now watched and followed your posts for a long while.
I will now tell you why you still did not get a clear answer to your question.
The answer is simple → you never described your PROJECT-SETUP in DETAIL.
I will do it now for you.
Hello everybody, i have an issue, i do not know–> How to query a date field and show with a lamp the DB-field isn´t empty? ← inside of my database.
This is my project-setup:
- I am using a DATASET → (ID: “#dataset5” ).
- My dataset is connected to → “Rentingmembers” - DATABASE .
- I have a repeater on my page, which is also connected to my DATASET ( “#dataset5” ).
The REPEATER is showing all of the elements of my database including all DB-Fields.
- Also i have 2-elements on my page → IMAGES (or SHAPES) ← (with ID: “#image138” and “#image139” ). By the way, don’t ask me why i have called them like these, because i do not know how to define and declare elements the right way.
I think, since i am using image-elements, may be i should define the element’S IDs as…
—> “imgOn” <— and —> “imgOFF” <—
To give you a better and more detailed overview i will add some pics to show you my SETUP…
MY-DATABASE:
Here you can see only the first 20-data-entries, but in realtime my database has 2000-items. In this example my DATABASE has the ID —> “DATABASE” (Rentingmembers).
Just used another database for example!
MY-DATASET: Here you can see the SETUP of my DATASET…(in this example it is has the ID —> “#dataset1” (dataset5)
MY REPEATER: Here you can see my REPEATER with the ID: “#repeater1” (standard ID)
The repeater shows all data from my database. You also can see the IMAGE on the very left side of the REPEATER, which should now show the current state (in this example) —> of my TITLE-FIELD. That means, if inside of my TITLE-FIELD there is some VALUE —> the identifying “IMAGE-ELEMENT” (in this example → “SHAPE-ELEMENT”), should show the correct state of the TITLE .
If title has a VALUE -----> SHOW SHAPE-ELEMENT
If title has no VALUE ---> HIDE SHAPE-ELEMENT
But exactly this is my problem! It does not work and i don’t know how to manage it, to show the current state of each TITLE’s value.
Someone advised me to use → BOOLEAN-FIELDS ← but i want to use the related fields directly.
MY USED IMAGE-ELEMENT:

Just a simple image (in this case a → SHAPE-ELEMENT).
Which should show the current state of each of my items inside my database.
If a title has a VALUE → the shape should show-up!
If there is NO-VALUE inside the title-field ----> the shape should get hidden.
I connected my repeater with my dataset, but i do not know how to get this function, because when i filter my dataset → the whole data which do not hit the seach-criteria, gets hidden, because it is not in the search-results.
I need a way, to show all my results and each of those result-items should show their current TITLE-STATE.
I am now searching for weeks for a simple functionality, maybe because i never have provided such an detailed setup of my project. I have opened several different posts, which made it just even worse. I jumped from one issue into the next, what confused me even more. My worst failure was → TO MIX WIX-DATA with a DATASET.
Maybe now someone can help me?
P.S.
Sorry one more time for generating several post, related to one and the same issue, i see now, it made everything just worse.
-
https://community.wix.com/velo/forum/coding-with-velo/how-to-query-a-date-field-and-show-with-a-lamp-if-it-isn-t-empty
-
https://community.wix.com/velo/forum/coding-with-velo/is-it-possible-to-combine-two-databases-in-this-way
-
https://community.wix.com/velo/forum/coding-with-velo/problems-with-collapse-and-expand
I won’t do it in future.
Reply from Velo-Ninja: Of course → your task should be normaly simple…
Check this code and modify it for your own needs…
//----------- USER-INTERFACE ------------------------------
let datasetID = "#dataset1";
let itemsLimit = 50;
let repID = "#repeater1";
let myDisplayElement = "#image138";
//----------- USER-INTERFACE ------------------------------
$w.onReady(()=> {console.log("Page is ready...");
$w(datasetID).onReady(()=> {console.log("Dataset is ready...");
$w(datasetID).getItems(0, itemsLimit)
.then((result) => {console.log(result);
let items = result.items; console.log("Items: ", items);
let totalCount = result.totalCount; console.log("Total-Count: ", totalCount);
let offset = result.offset; console.log("Offset: ", offset);
} )
.catch((err)=> {console.log(err);});
$w(repID).onItemReady(($item, itemData, index)=>{
console.log(itemData);
if (itemData.title) {
$item(myDisplayElement).show();
}
else {$item(myDisplayElement).hide();}
});
});
});
In this example, i used just one element for showing the state.
You can even delete this part of code…(This was just some additional info (try).
$w(datasetID).getItems(0, itemsLimit)
.then((result) => {console.log(result);
let items = result.items;
console.log("Items: ", items);
let totalCount = result.totalCount;
console.log("Total-Count: ", totalCount);
let offset = result.offset;
console.log("Offset: ", offset);
}).catch((err)=> {console.log(err);
});
So all you need is this…
//----------- USER-INTERFACE ------------------------------
let datasetID = "#dataset1";
let repID = "#repeater1";
let myDisplayElement = "#image138";
//----------- USER-INTERFACE ------------------------------
$w.onReady(()=> {console.log("Page is ready...");
$w(datasetID).onReady(()=> {console.log("Dataset is ready...");
$w(repID).onItemReady(($item, itemData, index)=>{
console.log(itemData);
if (itemData.title) {$item(myDisplayElement).show();}
else {$item(myDisplayElement).hide();}
});
});
});
I would say, first step done ! ! !
But why first step? What is the second one ???
Oh, and here you will find a working example (for short timem of period)…
https://velo-ninja.editorx.io/code-ninja/blank-2