Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
CoffeeFueledNerd
Contributor
Contributor

Insert symbol into string every x character

I'm pretty new to Qlik Sense and just figuring things out. Would take this question to my mentor but he's been sidelined by a massive project, so I'm on my own for the time being.

What I'm dealing with is an app which loads numerous CSV's. Each of these has a computer MAC address field which is listed in the format AABBCCDDEEFF from the CSV source. What I'm wanting to do is to insert a "-" every 2 characters in order to make the MAC's display as AA-BB-CC-DD-EE-FF. More than looking nicer, this will let them interface with our backend DHCP system. 

It does't matter if this happens at the data load phase or if I'm completely missing a way to make the front end do this for me in the tables. Just so long as I end up with a table that is correctly hyphenated for the MAC field. 

Thank you ahead of time for any help with this. I greatly appreciate the assist. 

1 Solution

Accepted Solutions
Or
MVP
MVP

If the format is always six groups long, I'd just brute-force it instead of trying to write something elegant...

Load Mid(MAC,1,2) & '-' & Mid(MAC,3,2) & '-' &  Mid(MAC,5,2) & '-' & Mid(MAC,7,2) & '-' & Mid(MAC,9,2) & '-' & Mid(MAC,11,2) as FormattedMAC

From YourTable;

 

 

View solution in original post

2 Replies
Or
MVP
MVP

If the format is always six groups long, I'd just brute-force it instead of trying to write something elegant...

Load Mid(MAC,1,2) & '-' & Mid(MAC,3,2) & '-' &  Mid(MAC,5,2) & '-' & Mid(MAC,7,2) & '-' & Mid(MAC,9,2) & '-' & Mid(MAC,11,2) as FormattedMAC

From YourTable;

 

 

CoffeeFueledNerd
Contributor
Contributor
Author

Thank you @Or. That solution worked perfectly for me. I had no clue Mid was a command... still quite a ways for me to go.

Thanks again!