Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
April 9th: The AI Roadmap: 6 Landmarks for AI-ready Data and Analytics: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use of Mid() at a specific marker

Hello all,

I'm trying to  extract the value in a string beyond a specific point in the script.

In a field named 'Project' I have different values and I want to extract the value after the '#' in the data, the # moves in the statement dependant on a prefix so can be in position 4 or position 5 as in the example below

92;#35/05099

or

675;#35/08627

I want them to return 35/05099 & 35/08627 respectively.

MID() seems to be part of the answer but requires a fixed 'start point' like

 

mid(Project,5,12)

Provides 35/05099 but #35/08627 for the second argument - how can I 'see' the # and count from there?

Cheers!

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try subfield(Project,'#',2)


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

if field name is myField:

mid(myfield, index(myfield,'#'))

iHope it helps

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try subfield(Project,'#',2)


talk is cheap, supply exceeds demand
MayilVahanan

Hi

Try like this

Load SubField('675;#35/08627','#',2) As Test AutoGenerate 1;

or

Load SubField(FieldName,'#',2) As FieldName;

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Sokkorn
Master
Master

Hi Jeff,

Let see

SubField('92;#35/05099','#',2)         Return 35/05099

SubField('675;#35/08627 ','#',2)      Return 35/08627

So you can try SubField function to do your job.

Regards,

Sokkorn

Not applicable
Author

All of the above worked - but the one that worked the best for my particular worksheet was subfield(Project,'#',2) by Gysbert Wassenaar

A big thank you to all the responders.

Jeff.