repeater pulling the same text using code

hi guys,

i tried this tutorial at the below link but my problem is when i am pulling the text from the repeater,it shows the same constant text for each different item in the database! ie the same text field shows for each different receipe. have i done something wrong in the code belwo
https://support.wix.com/en/article/wix-code-tutorial-creating-a-show-more-link#working-with-dynamic-text

let fullText; // variable to hold the full text
let shortText; // variable to hold the short version of the text

$w(“#dataset1”).onReady( function () {
// how many characters to include in the shortened version
const shortTextLength = 500;
// set the fullText variable to be the text from the collection
fullText = $w(‘#dataset1’).getCurrentItem().description;
// if no text to display, collapse the text element and the button
if (!fullText) {
$w(‘#gamedescription’).collapse();
} else {
// if the text has fewer or the same number of characters as shortTextLength characters, display it as is and collapse the “Show More” button
if (fullText.length <= shortTextLength) {
$w(‘#gamedescription’).text = fullText;
} else {
// create the shortened version of the text and display it in the text element
shortText = fullText.substr(0, shortTextLength) + “…”;
$w(‘#gamedescription’).text = shortText;
}
}
});

if it helps…i think it has something to do with this post

i am thinking i should not be using the current item function.

I don’t see a Repeater anywhere.

dataset1 is the database and gamedescription is the text box is where the data is being put too

they all sit within a repeater

sorry boss, if its help…i think my use of the get currentitem function is stuffing me up

hi tried adjust the code to this but with no luck :frowning: any help appreciated

$w.onReady( function () {
//TODO: write your page related code here…

let fullText; // variable to hold the full text
let shortText; // variable to hold the short version of the text

$w(“#repeater1”).onItemReady( ($w, itemData, index) => {

// how many characters to include in the shortened version
const shortTextLength = 500;

 fullText = itemdata.description; 

if (fullText <= shortTextLength) {
$w(‘#gamedescription’).text = itemData.description;

    }  **else**  { 

// create the shortened version of the text and display it in the text element
shortText = fullText.substr(0, shortTextLength) + “…”;
$w(‘#gamedescription’).text = shortText;

   } 

});

Please post the editor URL of your site. Only authorized Wix personnel can get access to your site in the editor. Please include the name of the page involved.

https://www.igmaker.com/list-of-indie-games

i tried playing around with the code, but just cant get it to shorten to less than 500 constants :frowning:

You have an error in the code:

@yisrael-wix sigh :frowning: