Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
erezzoni
Contributor
Contributor

MID function not working

HI, I am trying to fin a certain cod in a string it always start with "PC" and the a number and it always finishes with "/"

I am using the following expression:

mid( FIELD ,Index(FIELD, 'PC'), index(FIELD, '/') - Index(FIELD, 'PC'))

It was working fine ... until I came to the following string: 

PEDIDO/RTO1286/PC2247/AC

It dosnt work in this string. All I can find is that the reason is because of the "/" character before PC

 

Can it be? Is there a workaround for this?

Thanks in advance

1 Solution

Accepted Solutions
chriscammers
Partner - Specialist
Partner - Specialist

I think the subfield function might help you.

 

SubField(SubField([YourField],'PC',2),'/',1)

 

So this would be a two step process the inside function would give you  '2247/AC'

The outside function call would remove the rest giving you '2247'

This is one of my favorite functions I hope you find it helpful.

Chris

View solution in original post

2 Replies
chriscammers
Partner - Specialist
Partner - Specialist

I think the subfield function might help you.

 

SubField(SubField([YourField],'PC',2),'/',1)

 

So this would be a two step process the inside function would give you  '2247/AC'

The outside function call would remove the rest giving you '2247'

This is one of my favorite functions I hope you find it helpful.

Chris

erezzoni
Contributor
Contributor
Author

Thank you very much Chris! 

Problem solved