Truncating repeater values?

advanced-prototyping

#21

Alright man I just don’t get what I am doing wrong. I can’t get anything to work conditionally. I have attached the file. Check on page 2 of this file.

I have the conditions shut off.

The setup logic is: IF the string called from the repeater source is greater than 8 char, THEN truncate the text and add the elipses. ELSE IF the string is less than 8 char just print the repeater source text as is.

sorry man, thanks for the help!tooltip truncation.rp (89.1 KB)


#22

No worries. This should show what’s going on.

The upshot of it:

CASE 1:
If [[item.nameLast.length]] is greater than "10"
    Set text on repeater.nameLast equal to "[[item.nameLast.substr(0,10)]]..."
CASE2:
Else If True
    Set text on repeater.nameLast equal to "[[item.nameLast]]"

#23

Very helpful adaption @aconwell
THX!


#24

The conditional isn’t really necessary here. You could use the first case only without the condition. If the string is less than 10 characters then nothing happens since if the ending index supplied to substr is beyond the length of the string then the whole string is returned.


#25

The conditional is there to add the ellipsis. Otherwise, short last names would appear like “Smith…”


#26

Oh, hah. That got cut off perfectly in the formatted text area. Didn’t even see it.


#27

Thank you for this! It really helped me deal with a massive truncation challenge I was facing in my prototype!