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

string

Below is string

S&P 500 Consumer Discretionary Sector Index = Discretionary EPS % change

Industrials EPS % change

S&P 500 Consumer Staples Sector Index = Staples EPS % change

Energy EPS % change

out of above i need to extract

S&P 500 Consumer Discretionary Sector Index = Discretionary

Industrials

S&P 500 Consumer Staples Sector Index = Staples

Energy

Respectively, can you please suggest which string function shall i use.

thanks

1 Solution

Accepted Solutions
krishna_2644
Specialist III
Specialist III

If the positions of the substrings does not change in the field, then you can use

Field A

S&P 500 Consumer Discretionary Sector Index

S&P 500 Consumer Staples Sector Index

Field B

Discretionary EPS%  change  Industrials EPS % change

Staples         EPS%  change  Energy EPS % change

solution:

Subfield(Field B,' ',1) & ' ' & Subfield(Field B,' ',4)


let me know if it works for you after checking.

thanks

View solution in original post

6 Replies
krishna_2644
Specialist III
Specialist III

If the positions of the substrings does not change in the field, then you can use

Field A

S&P 500 Consumer Discretionary Sector Index

S&P 500 Consumer Staples Sector Index

Field B

Discretionary EPS%  change  Industrials EPS % change

Staples         EPS%  change  Energy EPS % change

solution:

Subfield(Field B,' ',1) & ' ' & Subfield(Field B,' ',4)


let me know if it works for you after checking.

thanks

Clever_Anjos
Employee
Employee

Maybe

Subfield(Field B,'=',1) & ' ' & Subfield(Subfield(Field B,'=',2),' ',1) & ' ' & Subfield(Subfield(Field B,'=',2),' ',5)


should return what you need

krishna_2644
Specialist III
Specialist III

ya, if

S&P 500 Consumer Discretionary Sector Index = Discretionary EPS % change Industrials EPS % change

S&P 500 Consumer Staples Sector Index = Staples EPS % change Energy EPS % change

are data values of one single field then you can use cleveranjos‌ expression:

Subfield(Field B,'=',1) & ' ' & Subfield(Subfield(Field B,'=',2),' ',1) & ' ' & Subfield(Subfield(Field B,'=',2),' ',5)


else

if they belong to different fields


Field A

S&P 500 Consumer Discretionary Sector Index

S&P 500 Consumer Staples Sector Index

Field B

Discretionary EPS%  change  Industrials EPS % change

Staples         EPS%  change  Energy EPS % change


then us expressions


solution1:

Subfield(Field B,' ',1) & ' ' & Subfield(Field B,' ',4)

let me know which one works for you after checking.


rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

=TextBetween(text, '','EPS')

-Rob

http://masterssummit.com

http://robwunderlich.com

MarcoWedel

=Replace(yourstring,'EPS % change','')

MarcoWedel

QlikCommunity_Thread_165796_Pic1.JPG

hope this helps

regards

Marco