This is a question posted many times so i have tried to follow the guidance. This code does not work for me and i feel like i need to declare the field as an itemData or something and possibly disconnect the text element from the repeater?But this code seems to work for others
$w.onReady( function () {
$w(“#dataset1”).onReady( function () {
const shortTextLength = 40;
let fullText;
let shortText;
$w(“#repeater1”).forEachItem(($w,item) => {
fullText = $w(‘#dataset1’).getCurrentItem().answer;
if (!fullText.length) {
$w(‘#text67’).collapse();
} else
if (fullText.length <= shortTextLength) {
$w(‘#text67’).text = fullText;
} else {
shortText = fullText.substr(0, shortTextLength) + “…”;
$w(‘#text67’).text = shortText;
}
})
});
});
Thanks
Adam