It is a string yes, as I say in my example above. I tried the ‘448’, no luck.
If I convert $w( “#counter” ).text = String (count); to $w( “#counter” ).text = Number (count);, the getTotalCount doesn’t work, I get no results. Back to string and I get all my db’s results in the text box.
@jonatandor35
Yes J.D. is right, you forget once again, that first everything has to be loaded, before you want to get some results.
It is now the second time, where “onReady” makes troubles for you.
You remember…
Async-Await
.then()
onReady
Thanks J.D. did not see it.
But don’t worry. i have also sometimes troubles to use this knowledge.
@jonatandor35@russian-dima by everything, you mean of course the conditionals if-else and not the export function. So something like this? If yes, it doesn’t work. Counter stops working at all. Somehow it takes precedence over the export function to calculate the getTotalCount.
@russian-dima adding an unnecessary “await” to a non-promise function shouldn’t make a problem, but removing all the unnecessary code may help locating the issue.
These are the hidden boxes I want to show/hide according to getTotalCount number (which for this example’s sake let’s say it’s the number ‘446’, could be anything though).
And this is the complete code on that page. Most of it are nicely working export functions for my tooltips (small question marks below the dropdown menus):
$w.onReady (function() {
$w("#dataset1").onReady(async() => {
let count = await $w("#dataset1").getTotalCount();
console.log(count)
$w("#counter").text = count.toString()
if ($w("#counter").text === "446") {
$w("#text29").show();
}
else {
$w("#text26").show();
}
})
});
export function table1_dataChange(event) {
let count = $w("#dataset1").getTotalCount();
$w("#counter").text = String(count);
}
export function hoverZone_mouseIn(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverEfarmostiki').show();
$w('#checkbox2').hide();
$w('#vectorImage3').hide();
$w('#hoverBox').show();
}
export function hoverZone_mouseOut(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverEfarmostiki').hide("fade");
$w('#checkbox2').show("fade");
$w('#vectorImage3').show("fade");
$w('#hoverBox').hide("fade");
}
export function hoverzoneEfarm1_mouseIn_1(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverYpoyrgeio').show();
$w('#hoverboxYpoyrgeio').show();
$w('#hoverzoneEfarm').hide();
}
export function hoverzoneEfarm1_mouseOut(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverYpoyrgeio').hide("fade");
$w('#hoverboxYpoyrgeio').hide("fade");
$w('#hoverzoneEfarm').show("fade");
}
export function hoverzoneIsxyon_mouseIn_1(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverboxIsxyon').show();
$w('#hovermainIsxyon').show();
$w('#vectorImage2').hide();
$w('#checkbox1').hide();
}
export function hoverzoneIsxyon_mouseOut_1(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w('#hoverboxIsxyon').hide("fade");
$w('#hovermainIsxyon').hide("fade");
$w('#vectorImage2').show("fade");
$w('#checkbox1').show("fade");
}
@jonatandor35 Async and await removed. Still no progress. Neither text box is shown up meaning neither IF nor ELSE are being processed… If you don’t have any other idea, I’m heading to ‘rolling out improvements’ section… (db not in write only).
But I’d first try to remove everything from the code except for the code that is inside the $w.onReady(). Just to make sure it’s not something in the other code (it’s probably not),