ToList() Function for Text Field?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I'm using a Text field with logging to track comments and notes to a record. I'd like to be able to separate those comments out and measure the length of each one to determine the maximum character length for styling purposes (sizing a drop-down on a report). I know the Part() function can find particular pieces, but as they are comments there is an indeterminate number. Is there a natural formula function that loops through this for every comment? 

If not, is there another solution? I'm thinking either:

  1. Creating a formula field for forms that gets the length of the comment when the record is saved, and compares to itself and updates if it is longer than all previous comments, and then referencing this value. 
  2. Or, using a whole heap of inline javascript to do essentially the same thing. 
Any ideas?
Photo of Sam C

Sam C

  • 322 Points 250 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Any reason why you wouldn't want to switch to comments being stored on a child table?
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
Using the "logging" setting is always a messy way to do things.

My recommendation would be to make a "Notes" child table, so then you have more information about the actual note, and you can add as many notes as you'd like. 

This also keeps the tracking and display clean.  Give the same timestamp and record owner information.

You can then use just one formula field to count the characters in the note field, and do your styling off of that.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,278 Points 50k badge 2x thumb
I agree with Matthew on the child table , but if you do not want to go to a child table, you can brute force it by having a formula which looks at each of say the first 50 "Parts" and measures their LENGTH.  The formula code would be long but very repetitive.

var  number PA = xxxxxx
var number PB = xxxxxx
var number PZ =

Max($PA, PB ....$PZ)
Photo of Sam C

Sam C

  • 322 Points 250 badge 2x thumb
I ended up going with the formula fields for the entry forms and using that to determine the length.

The reason the comments are not in a child table is because this is displaying them on a dropdown menu in a report. So the ultimate goal of determining the maximum length of the comments is to properly format that dropdown. I've attached a picture to show the menu I'm describing. 

If the records were in a child table showing the comments on the parent report would just become all the more cumbersome I feel. Also there aren't really enough comments per record to really justify tracking and logging them on a more substantial basis.