I have a text attribute that contains leading spaces for formatting purposes.
How can I prevent them automatically being clipped when displayed in a query?
Thank you.
Solved: How to prevent leading spaces being clipped?
Solved: How to prevent leading spaces being clipped?
Last edited by MichaelQ on Mon Mar 05, 2018 2:07 pm, edited 1 time in total.
Michael Q
Devon, UK
Devon, UK
Re: How to prevent leading spaces being clipped?
what if you had a 2nd field (Field2) that was always initialized to your desired field.
Field2 is a type HTML.
You do a REPLACE (or whatever) to change leading spaces to
Display this field in the query
jaymer...
Field2 is a type HTML.
You do a REPLACE (or whatever) to change leading spaces to
Display this field in the query
jaymer...
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 7527
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: How to prevent leading spaces being clipped?
The TRIM function clips both leading and trailing spaces. Check it out.
Aware IM Support Team
Re: How to prevent leading spaces being clipped?
Thanks Jaymer.
I didn't understand what you meant by "Field2 is a type HTML". I couldn't find an HTML field type. So I just used a text attribute and added leading spaces using ' ' as you suggest, which worked!
Thanks Support.
I searched for 'TRIM' in the User Guide & Rule Language pdfs but couldn't find any reference to this function. Anyway Jaymer's solution worked.
I didn't understand what you meant by "Field2 is a type HTML". I couldn't find an HTML field type. So I just used a text attribute and added leading spaces using ' ' as you suggest, which worked!
Thanks Support.
I searched for 'TRIM' in the User Guide & Rule Language pdfs but couldn't find any reference to this function. Anyway Jaymer's solution worked.
Michael Q
Devon, UK
Devon, UK
Re: How to prevent leading spaces being clipped?
glad that worked
the HTML is an option for FORMAT on a Plain Text field. (see pic) I was suggesting you'd have a rule to pad with the blanks. In this example, I just typed this in using the HTML formatter.
Here's how it would look in a Query
the HTML is an option for FORMAT on a Plain Text field. (see pic) I was suggesting you'd have a rule to pad with the blanks. In this example, I just typed this in using the HTML formatter.
Here's how it would look in a Query
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: How to prevent leading spaces being clipped?
Here is whats stored in the database for the HTML field:
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: How to prevent leading spaces being clipped?
Thank you.
This solution raises a question about programming elegance.
I am displaying a nested hierarchy by padding spaces using a 'TreeDepth' attribute which may be 0-9. Currently I have to write a rule for each level like this (each level is indented by 4 spaces):
If Item.TreeDepth=1 Then
Item.Name4Tree=' '+Item.Name
Is there a way that I could write one rule which will add the required number of spaces according to the TreeDepth?
This solution raises a question about programming elegance.
I am displaying a nested hierarchy by padding spaces using a 'TreeDepth' attribute which may be 0-9. Currently I have to write a rule for each level like this (each level is indented by 4 spaces):
If Item.TreeDepth=1 Then
Item.Name4Tree=' '+Item.Name
Is there a way that I could write one rule which will add the required number of spaces according to the TreeDepth?
Michael Q
Devon, UK
Devon, UK
Solved: How to prevent leading spaces being clipped?
I figured out how to compose this action more concisely so that each level in the hierarchy is indented by an additional 6 spaces:
Item.Name4Tree=''
Item.Name4Tree=PAD_LEFT(Item.Name,' ',Item.TreeDepth*6+LENGTH(Item.Name))
Item.Name4Tree=''
Item.Name4Tree=PAD_LEFT(Item.Name,' ',Item.TreeDepth*6+LENGTH(Item.Name))
Michael Q
Devon, UK
Devon, UK