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

Programmatic search. Search String in Expression

Hello,

Im able to identify the dimensions via the expression but unable to display the text only i wish to see. 

Below is the result which is correct however i only wish to display the String text containing and starting with PLRF

Expression is

only({<CustItemRef={"*^PLRF*"}>}CustItemRef)

Need to have the CustItemRef only show PLRF01012111

Screenshot 2021-10-16 at 10.27.49.png

Thank you i hope the is a good explanation.  

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

I think it should work in this way by this case. Depending on your data you may need multiple replace() statements and/or also some further string-functions like trim(), keepchar() and similar.

Especially if there are really n different types and/or it's used several times and/or there are further requirements with additionally TOTAL or aggr() - it would be better to make these things within the script and not in the UI.

- Marcus

View solution in original post

9 Replies
sasikanth
Master
Master

Try

Wildmatch(CustItemRef, '*PLRF*')

bnelson111
Creator
Creator
Author

Thank you, this will just confirm if PLRF is in text string.

Im able to get the result but just want to display the result below as PLRF01012111 not the -H61761

Screenshot 2021-10-17 at 21.12.29.png

 Thanks

 

sasikanth
Master
Master

 

Chart: Straight table

Dimensions: ItemCode , CustItemRef

Exp: Wildmatch(CustItemRef, '*PLRF*')

 

Hide the above expression (Presentation--> hide column) 

bnelson111
Creator
Creator
Author

Unfortunately still giving the full CustItemRef i only want the PLRF01012111

 

bnelson111_0-1634544535485.png

Thanks

marcus_sommer

You may try it with: subfield(YourExpression, ' ', 1)

- Marcus

bnelson111
Creator
Creator
Author

Yes this absolutely trims it and helps, still struggling to trim it and pull it out of a long text string.

For example 

Here is PLRF01012111-jjj in a string

I just want the PLRF01012111

 

But massive thanks 

marcus_sommer

The more variance are in your data the more efforts are needed to consider them all. To extend it to this case you may add a replace, like:

 subfield(replace(YourExpression, '-', ' '), ' ', 1)

 - Marcus

bnelson111
Creator
Creator
Author

Very close just now, thank you 🙂 

subfield(replace(only({<CustItemRef={"*^PLRF*"}>}CustItemRef), '-', ' '), ' ', 1)

Just need the - H61760 dropped

bnelson111_0-1634645284931.png

 

marcus_sommer

I think it should work in this way by this case. Depending on your data you may need multiple replace() statements and/or also some further string-functions like trim(), keepchar() and similar.

Especially if there are really n different types and/or it's used several times and/or there are further requirements with additionally TOTAL or aggr() - it would be better to make these things within the script and not in the UI.

- Marcus