I have column names that are long, and the table would look better if the column headers could be splits into two lines.
For example, "NonHispanic H.S. Dropouts" would be better as
NonHispanic
H.S. Dropouts
and more columns could fit in the table.
Is this possible?
Thanks.
Hi @Newt
Can some provide some more examples as well as the rules as to how you'd like the strings to be split?
Dan
Hi Dan,
I'd like to be able to do in Alteryx what one can do in Excel. There, you can split text to two or more lines by inserting an Alt/Enter and it breaks the text at that point.
This would be faster than figuring out some sort of rule-based split.
But is either possible to split column headers at some pre-determined spot? I know that making the width smaller will force the headers into two lines, but the split is not consistent. For example, I'd want
Hispanic
H.S. Dropouts
and
Asian
H.S. Dropouts
and not
Asian H.S.
Dropouts
that results from just making the column narrower. I want to make the type of info on each line of the two-line headers consistent, so that one could scan the column headers more easily to find the race, or see groupings of Dropouts / Grads / College etc.
Thanks.
David
Sometimes I feel like Beetlejuice when I appear after my name is used. 😁
There is kind of a way to achieve this using the Reporting tools and Rendering to Excel. The idea is that you create two rows that look like a header and stack them vertically. The only downside is that in Excel, they technically are on two rows instead of one tall row.
I've attached a workflow to show you this can be achieved, but here's a few highlights:
- All of the tables we're creating will not have headers generated by the Table tool. In the Table tool configuration, there is an option to deselect "Show Column Headings".
- As mentioned above, create the "header" values as separate tables.
- Join the tables together and in the Layout tool use "Vertical Merge Contents to Line up Table Columns"
- As an added bonus, when you create the header tables, fill the cells with a color so they look like a real header.
Hi @Newt
@CharlieS, @CharlieS, @CharlieS probably has the best solution here, but if you'd like to replicate the Alt-Enter functionality you can do that as well. For example, with the phrases "American H.S Dropouts", "Hispanic College Graduates", and "Asian H.S. Graduates", you want to replace the first space with a line feed character (#10) so that the line wraps after "American" and "Asian" and "Latin American". You can do this with a formula tool and the following regex
regex_replace([Eduation],"(.*?)\s(.*)","$1"+CharFromInt(10)+"$2")
There's also another option you can look at. When most applications try to wrap text to fit in given length they preferentially use certain characters, hyphen, space, etc to breakup the line. In your case, you want certain spaces to be treated as if they were normal non-wrapping characters. There's a character known as a non-breaking space(nbsp), #160 in ASCII, Unicode, UTF-8, and most windows code pages. Visually it's identical to a space, but when applications see it, they treat it as if it were a letter and ignore it, and try to wrap the line at a another position instead. You can use this to your advantage by replacing some of the spaces with non-breaking spaces.
Dan
When I feed your Formula output into a Basic Table, the "Filed 1 two lines" shows up as a single line: Asian H.S. Dropouts
When I feed the Table into a Layout and into a Render, it's still a single line.
The goal is to be able to force particular breaks in a Table's header.
Am I misunderstanding your solution?
David
Hi Dan,
I tried your RegEx solution of inserting the line feed, but when this flow goes into a Basic Table, Alteryx ignores the line feed and puts everything on a single line.
I had thought about the @CharlieS solution, but I had wanted to retain the formatting options available for a separate header section. I suppose I can set up row rules to accomplish much the same thing, but I've not tested that...
Thanks for trying!
David
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
6 |