My formula text field references the first 200 characters of a text field with logging enabled; how do I maintain the logging format? My formula field compresses text.

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
We have a text field with log edits enabled to capture comments. This field has become quite long for reporting, so we want to use a formula text field to show the first 300 characters captured on the report.

The original text field may look like this:

[DEC-30-15 User Name] Job is complete all change orders here & bill 100%

[DEC-11-15 User Name] We should be complete with this project next week ,

[NOV-20-15 User Name] ++

[AUG-24-15 User Name] Cost should be for installation


The text field referencing the first 100 characters looks like this:

[DEC-30-15 User Name] Job is complete all change orders here & bill 100[DEC-11-15 User Name] We should be complete with this project next week , [NOV-2015 User Name] ++[AUG-24-15 User Name] Cost should be for installation

Is there any way to maintain the spacing, line breaks in the formula text field?
Photo of Maria

Maria

  • 30 Points

Posted 3 years ago

  • 0
  • 1
Photo of Jack

Jack, Champion

  • 50 Points
Hi,

I have had this issue before, and used the example below, its not perfect but it may make it more usable.

In your text field that you use as the source to populate your audit/append/reference field try this and turn on allow html:

List("",

"<BR>"&ToText([FIELD 1])&"<BR>",

ToText([FIELD 2])&"<BR>",

ToText([FIELD 3])&"<BR>",

ToText([FIELD 4])&"<BR>")



Then in your text referencing field also turn on allow html.

Add or remove BR tags to suit.

Jack
Photo of Maria

Maria

  • 30 Points
I appreciate  your answer. However, my source is just one field with the logging properties set to on, so unfortunately I can't use your suggestion. My new field just references the first 300 characters of the source field. The new field compresses all the text from the source field.

For example [TEXTFIELD1], has logging enabled. End users type in their comments and using [TEXTFIELD1] in a report looks like this:

[DEC-30-15 User Name] Job is complete all change orders here & bill 100%

[DEC-11-15 User Name] We should be complete with this project next week ,

[NOV-20-15 User Name] ++

[AUG-24-15 User Name] Cost should be for installation

It looks great, but eventually, the contents of TEXTFIELD1 become so long that it was not prudent to use it for reports.

We now just want to call up a bit of the contents from TEXTFIELD1. So I created a new field, TEXTFIELD2 = (LEFT([TEXTFIELD1],300)
This new field, for some reason compresses all the spaces and formatting that [TEXTFIELD1] had and looks like this in a report.

[DEC-30-15 User Name] Job is complete all change orders here & bill 100[DEC-11-15 User Name] We should be complete with this project next week , [NOV-2015 User Name] ++[AUG-24-15 User Name] Cost should be for installation

The contents are all squished together!  Wondering if there is a way where I can get that break in there!
Photo of Jack

Jack, Champion

  • 50 Points
The answer here is your converting what is a multi line field format into a kind of plain text format by using the left function:

My
Name
Is

becomes

mynameis

During the conversion the formatting is lost which is why it is displaying as it is.

Now that aside there is a way to do this.

The field that you are using for your LEFT formula [TEXTFIELD2], amend it to the below after enabling hmtl.

"<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;'>"&Left([TEXTFIELD1],300)&"</pre></span>"

Then just play around with the fonts, formatting/styles to suit.
Photo of Maria

Maria

  • 30 Points
Brilliant! That worked!  Thank you so much!
Photo of Matthew

Matthew

  • 60 Points
Jack, Thank you! I was also looking for this exact solution. I have just one problem though; long lines of text are not breaking. So if there's say a paragraph in [TEXTFIELD1] with no line breaks, it show as one continuous line in the formula field. Meaning my reports are now stretched out two monitors wide...
I tired adding
word-wrap:break-word!important;
after the font-size tag, but it doesn't seem to have any effect. Could you help me out?
Photo of Matthew

Matthew

  • 60 Points
Answered my own question. Use white-space: pre-wrap instead