Hello.
My idea basically is to let the “# button” pick the only URL from the database column.
The problem I am facing right now is, the button which is connected to the Database URL does not work as it picks the URL field which is empty.
What I am trying to do is to let it pick the nonempty field and make it the URL for the button.
Please see the # button21 and ‘members database’ pictures.
For your reference:
button: # button 21
Database: Members- Database
Dataset: dynamicDataset
field key (for Database Connection): scheduleYourAppointments
I know very little about code.
I was able to achieve success with one such problem of picking the cells which are not empty for the table.
For button, it’s completely hard for me.
Please help.
Hello again Pulkesh.
Ok, you say you have a dynamic dataset, so it means everytime when you go to a dynamic page —> you enters a row in the database.
Example you are on dynamic-page-9 —> row-9 in your database.
To achieve your aim, you have to query your DATABASE without dataset, because your dataset on this page is dynamic (or you create a second one —> non-dynamic-dataset)
But the best way would be to use a DATABASE-Query…
import wixData from 'wix-data';
wixData.query("Members-Database")
.find()
.then( (results) => {
if(results.items.length > 0) {
let firstItem = results.items[0]; //see item below
} else {
// handle case where no matching items found
}
} )
.catch( (err) => {
let errorMsg = err;
} );
…and filter the NON-EMPTY-ENTRY-FIELDS in your DATA-COLLECTION.
.isNotEmpty("sheduleNewAppointment")
Then your END-CODE should look like this one…
import wixData from 'wix-data';
function myFunction () {
wixData.query("Members- Database")
.isNotEmpty("sheduleNewAppointment")
.find()
.then( (results) => {
if(results.items.length > 0) {
let firstItem = results.items[0];
console.log(firstItem)
}
else { }
})
.catch( (err) => {let errorMsg = err;});
}
This function, should give you the RESULT of the NON-EMPTY ROW, when you look into CONSOLE!
As always,
It works
Thanks for the help Dmitri.
Thanks
Pulkesh
Nice to hear that it works
, you are welcome.