Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
reshmakala
Creator III
Creator III

Alignment with Concat

Hello All,

I have a concat statement where I  need to show 3 fields in a text box well aligned. Can anyone please help me with this?

Attached is the sample qvw.

6 Replies
sunny_talwar

You can try this, but this isn't perfect also:

=Concat(DISTINCT Name&'  |  '&Dept&Repeat(' ', Aggr(Max(TOTAL Len(Dept)) - Len(Dept), Dept))&'  |  '&Location,Chr(10))

Capture.PNG

rubenmarin

Hi Reshma, you can use something like:

=Concat(DISTINCT Name& Repeat(' ', 20-Len(Name)) & '  |  '&Dept& Repeat(' ', 10-Len(Dept)) &'  |  '&Location,Chr(10))

//Change '20' and '10' the the max length value for each field.

But unsless you use a monospaced font like courier it wouldn't work as each character can have a different width.

sunny_talwar

What I am doing here is to find the max length of the dept and then repeat an empty space for difference in length of each department.

So, for example, since sales is 5 character long and HR is 2 character, the above expressions adds 3 extra spaces in the text box

sunny_talwar

Changing it to Courier did help

Capture.PNG

reshmakala
Creator III
Creator III
Author

Thank you for your help Sunny. I am actually trying to implement this in the alert section. My email alerts are unaligned.

reshmakala
Creator III
Creator III
Author

I am actually trying to implement this in the alert section. My email alerts are unaligned.