Truncating text fields in Collection output displays

I changed it to the ‘email’ field since it has a longer string than the ‘firstName’ field:

export function dataset1_ready_1() {
$w(“#repeater1”).onItemReady( ($item, itemData, index) => {
$w(“#repeater1”).forEachItem( () => { //loop the function
var string = itemData.email; //description is the field name in the database
var length = 21; //total amount of words you want to display onscreen
var trimmedString = string.substring(0, length);
$item(“#text47”).text = String(trimmedString) + ‘…’;
});
});
} //Add your code for this event here: