Expand my Community achievements bar.

The next phase for Workfront Community ideas is coming soon. Learn all about it in our blog!

Character count if then validation?

Avatar

Level 1
Hello, I'd like to be able to add an if then statement to check if the character count for a string is greater than a specified number, but my formula is not valid. This is what I have so far,... IF(LEN(field)>140,"over limit","under limit") The field I'm pointing to is a single line text field. Using LEN() by itself works (returns the character count). Any suggestions?
7 Replies

Avatar

Level 10
I've seen calculations not update until you click the "Update previous calculations" checkbox when the field is selected in the Custom Form editor. A test in my Sandbox reveals that the calculation doesn't even stay intact. For example, I changed the calculation to >5 from >140 and saved it. Made a few edits to the project to see if the update applied. Then returned to the custom form and noticed that the field had reverted back to my original calculation of >140. I've never seen a calculated field "remember" what I had put in a while ago and revert back. This is not good behavior, and I'm going to test this in On-Demand now. I'm thinking that your problems with this should be logged as a bug. This way support can test and hopefully reproduce the problem.

Avatar

Level 2
Here is what I use. It's to look at the description is longer than 140 characters and if true will put the first 140 characters and append "...open project for full description" Hope this is what you were looking for. displayname= linkedname=direct namekey=description querysort=description textmode=true valueexpression=IF(LEN({description})>140,CONCAT(SUBSTR({description},0,139),"...open project for full description"),{description}) valueformat=HTML

Avatar

Level 1
Thanks, this helped! Here's what I ended up with: IF(LEN(Title)>75,CONCAT(LEN(Title)," WARNING: Title exceeds 90 characters"),(LEN(Title)))

Avatar

Level 10
Eric, that is a nice expression that summarizes a description in a report. I took your idea and adjusted it so it will show the latest updates on any object. This can be added to any report and is full of useful information, and avoids having to use shared columns. This will present in the report as follows: Less than 140 chars: This is my update. -- Narayan Raum on 5/25/16 Greater than 140 chars: This is my update where there are more than 140 characters in the update...(open for more) -- Narayan Raum on 6/7/16 displayname=Latest Update namekey=latest update textmode=true valueexpression=IF(LEN({lastNote}.{noteText})>140, CONCAT(SUBSTR({lastNote}.{noteText},0,139),"...(open for more) -- ", {lastNote}.{owner}.{name}," on ", {lastNote}.{entryDate}), IF(LEN({lastNote}.{noteText})>0, CONCAT({lastNote}.{noteText}," -- ", {lastNote}.{owner}.{name}," on ", {lastNote}.{entryDate}))) valueformat=HTML

Avatar

Level 2
Thanks! Adding to my arsenal...

Avatar

Level 10
Perhaps a discussion category for text-mode expressions should be created here in the community. I also have my own arsenal and would really enjoy sharing, viewing and collaborating within this community. Unless, of course, there is somewhere else that this is already occurring that I'm unaware of. I'll reach out to the moderators to see if this can be added.

Avatar

Level 1
Yes, please. I'm fairly new to Workfront and I know I would find great use in a discussion group on expressions.