$w.onReady( function () {
function gstrStatus(a,b) {
if ($w( ‘#dynamicDataset’ ).getCurrentItem().a === “Filed” ) {
return $w(b).style.backgroundColor = “#68B04D”
} **else if** ($w( '#dynamicDataset' ).getCurrentItem().a === "Not filed" ) {
return $w(b).style.backgroundColor = “#DB8688”
} **else if** ($w( '#dynamicDataset' ).getCurrentItem().a === "Submitted" ) {
return $w(b).style.backgroundColor = “#f4f499”
} **else if** ($w( '#dynamicDataset' ).getCurrentItem().a === "NULL" ) {
return $w(b).hide()
} else {
return $w(b).style.backgroundColor = “#DBDBDB”
}
}
let a=[ ‘gstr3BApr19’ , ‘gstr3BMay19’ , ‘gstr3BJun19’ ]
let b=[ ‘#boxApr3B’ , ‘#boxMay3B’ , ‘#boxJun3B’ ]
gstrStatus(a, b)
for ( var i = 0 ; i < a.length; i++) {gstrStatus(a, b)
}
console.log(gstrStatus());
});
Error: The value passed to the element selector function (usually $w), must be of type string ---- Line 19
This code need to be looped:
$w.onReady(function () {
function gstrStatus() {
if ($w('#dynamicDataset').getCurrentItem().gstr3BApr19 === "Filed") {
return $w('#boxApr3B').style.backgroundColor = "#68B04D"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BApr19 === "Not filed") {
return $w('#boxApr3B').style.backgroundColor = "#DB8688"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BApr19 === "Submitted") {
return $w('#boxApr3B').style.backgroundColor = "#f4f499"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BApr19 === "NULL") {
return $w('#boxApr3B').hide()
} else {
return $w('#boxApr3B').style.backgroundColor = "#DBDBDB"
}
}
console.log(gstrStatus());
});
$w.onReady(function () {
function gstrStatus() {
if ($w(‘#dynamicDataset’).getCurrentItem().gstr3BMay19 === “Filed”) {
return $w(‘#boxMay3B’).style.backgroundColor = “#68B04D”
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BMay19 === "Not filed") {
return $w('#boxMay3B').style.backgroundColor = "#DB8688"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BMay19 === "Submitted") {
return $w('#boxMay3B').style.backgroundColor = "#f4f499"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BMay19 === "NULL") {
return $w('#boxMay3B').hide()
} else {
return $w('#boxMay3B').style.backgroundColor = "#DBDBDB"
}
}
console.log(gstrStatus());
});
$w.onReady(function () {
function gstrStatus() {
if ($w(‘#dynamicDataset’).getCurrentItem().gstr3BJun19 === “Filed”) {
return $w(‘#boxJun3B’).style.backgroundColor = “#68B04D”
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BJun19 === "Not filed") {
return $w('#boxJun3B').style.backgroundColor = "#DB8688"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BJun19 === "Submitted") {
return $w('#boxJun3B').style.backgroundColor = "#f4f499"
} else if ($w('#dynamicDataset').getCurrentItem().gstr3BJun19 === "NULL") {
return $w('#boxJun3B').hide()
} else {
return $w('#boxJun3B').style.backgroundColor = "#DBDBDB"
}
}
console.log(gstrStatus());
});