Problem with collapse option

Morning, everybody…
I’m having a problem with two codes on a dynamic page, I don’t know if I should link them…
I want my image gallery (galleryFictionLogo) and/or a button (Visionner le traler) collapse if the database is empty…
if I put one code it works, but if I put both, I have nothing left… Since I’m new to code, can someone tell me what I did wrong?
Thank you very much.

$w.onReady(() => {
$w( “#dynamicDatasetFICTION” ).onReady(() => {
const item = $w( “#dynamicDatasetFICTION” ).getCurrentItem();
if (!item.logoFestival) {
$w( “#galleryFictionLogo” ).collapse();
} }); });

$w.onReady(() => {
$w( “#dynamicDatasetFICTION” ).onReady(() => {
const item = $w( “#dynamicDatasetFICTION” ).getCurrentItem();
if (!item.LienFiction) {
$w( “#buttonTRAILER” ).collapse();
} }); });

@emiliepaillotgraphis There should be only one page onReady. Try moving the logic of the second one within the first one. You will need only one dataset onReady and one getCurrentItem() line as well.

Thank @tony-brunsman !
It works!