HI Ron:
It looks like you solved your problem as the page is now published. The code you have used is:
export function page1_viewportEnter(event) {
let count = $w("#dataset1").getTotalCount();
count = count.toString();
$w("#txtRecCount").text = "There were " + count + " books found";
}
Just for clarity it is probably better if you don’t rewrite the type of your count variable. It works in this instance but in future code as your skills build you may confuse others trying to read your code. So a suggestion would be to do one of two things either:
export function page1_viewportEnter(event) {
// Get the total count and convert it to a string for display
let count = $w("#dataset1").getTotalCount().toString();
$w("#txtRecCount").text = "There were " + count + " books found";
}
or
export function page1_viewportEnter(event) {
// Get the totalCount. This is a number which will need converting for display
let count = $w("#dataset1").getTotalCount();
// Insert count into display string making sure to convert number to string
$w("#txtRecCount").text = "There were " + count.toString() + " books found";
}
Glad you got the problem sorted.
Steve