I need some help here. in the database, I created a files name ActiveStatus. the value is true or false. on the report, I created an active button that I wanted to be displayed when Activestatus is True and hide when active is false. it is a simple if statement but it not working. anyone has a sample. The active button is in a repeater
please advise
In your onReady function, try and retrieve the current Item of the repeater, and then get the status. Show and hide the different buttons depending on the retrieved status. Your code could look something like this. Just change out the “activestatus” to whatever the field in your dataset is.
$w . onReady (() => {
let status = $w ( “#dynamicDataset” ). getCurrentItem ().activestatus
if (status === true) {
$w(‘#activebutton’).show();
} else {
$w(‘#activebutton’).hide();
}
});
I really appreciate your response. i wan to be clear on something here. Is #dynamicDataset the filed name, the field key or database name.
it also telling me $w(…).getCurrentItem is not a function
I followed your code.
Contractorslist is the database
activeStatus is the field key
active is the button name
still the same error
$w . onReady (() => {
let status = $w ( “#Contractorslist” ). getCurrentItem (). activeStatus ;
if ( status === true ) {
$w ( ‘#active’ ). show ();
} else {
$w ( ‘#active’ ). hide ();
}
});
@writesolution
Dataset has first to be ready, before working with it.
@nhbarakat
$w . onReady (()=>{
$w(#‘dynamicDataset’).onReady(()=>{…
//First dataset must be ready, before use it …
let status = $w ( " #Contractorslist " ). getCurrentItem (). activeStatus ;
if ( status === true ){
if ( status ){ //<-- more simple…
$w ( ’ #active ’ ). show ();}
else { $w ( ’ #active ’ ). hide ();}});