Skip to main content
Announcements
New: No-code data prep in Qlik Cloud Analytics™ TAKE A TOUR
cancel
Showing results for 
Search instead for 
Did you mean: 
pedrohenriqueperna
Creator III
Creator III

Weird Subfield behavior in specific strings

Hi!

I'm having a hard time to figure out why using SubField(x, ' ', y) will work for about 1000 strings but, +- 5 strings will give me a blank for some substrings.

I'm writing something to deal with customer data and I'm looping through the customer substring names. Most iterations are working just fine, but these specific ones will show correctly the index number while debugging it, but as soon as the LET statement hits it adds a null to the variable, even tho it shows the correct index number. I tried to use the same expression in a different blank sheet and it worked perfectly, for some reason it doesn't work only in the main sheet...

Here are some prints:

therealdees_0-1701125036991.png

This is the end of the loop where index 2 gave me correctly the word ASSIS, from the vClienteNome. In the next iteration the index will change to 3 and it's supposed to give me OLIVEIRA.

 

therealdees_1-1701125050364.png

beginning the next iteration, nothing has changed yet, but at the next step the index will change to 3

 

therealdees_2-1701125069645.png

Index is now 3 and the next step should give me OLIVEIRA as it's the third word

 

therealdees_3-1701125094307.png

For some reason it gives me blank...

 

 

Can someone explain me wtf I'm missing? 🤔

 

 

 

 

Labels (2)
1 Solution

Accepted Solutions
pedrohenriqueperna
Creator III
Creator III
Author

It's kinda stupid, but I just found out it's a double space between the substrings. I actually considered that and tried using Trim(), but it didn't fix it because it won't trim inside spaces.

 

Using Replace(field, '  ', ' ') did the job.

 

Thank god.

View solution in original post

1 Reply
pedrohenriqueperna
Creator III
Creator III
Author

It's kinda stupid, but I just found out it's a double space between the substrings. I actually considered that and tried using Trim(), but it didn't fix it because it won't trim inside spaces.

 

Using Replace(field, '  ', ' ') did the job.

 

Thank god.