Length limit for elements that connected to database

Hello,

I need help to create a max-length code for text and other elements that connected to my database, for example:
I have a 100 characters text space that is connected to a 200 characters database text field. In that case all of the web design gets broken. It’s the same with images.

I’m looking for a code that keeps the text on his “editor” size, and end it with “…”

Anything?

Hey Shahaf,

You can try something like the following:

$w("#myDataset").onReady(() => {
    let text = $w("#myDataset").getCurrentItem().someTextField;
    if (text.length > 100) {
        text = text.substring(0,97) + '...';
    }
    $w("#myTextComponent").text = text;
});

Good luck!
Itai

Hey @itai-pelles

#myTextComponent is duplicated . How to fix it?