Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
JorisV
Contributor
Contributor

Selecting text from a field if certain phrase is present in field.

Hi All,

I'm loading a column that contains fields with quite an extensive amount of text.

I only want to show this field if it cointains the word memory.

Example (this is a single field, no separte columns, as it's part of an email):

memory: 4079640
scanner_type: Onbekend
scanner_firmware: Onbekend
scanner_dateofmanufacture: xxxxxxxxx
system serialnumber: xxxxxxxxx
scanner_serialnumber: xxxxxxxx

Then I want to select: 

memory: 4079640
scanner_type: Onbekend
scanner_firmware: Onbekend

and only display these three lines. Can anybody

help with the expression for this?

Thanks in advance, 

Joris

Labels (1)
  • SaaS

2 Replies
hic
Former Employee
Former Employee

If it's in the script and you want to load records where "Field" contains 'memory' I would use

Load ... From ... Where Index(Lower(Field),'memory') ;

But what is the logic around the other two records? Is it the two lines that come right after this row? If so, you could use

Load * Where AcceptedRow or Peek(AcceptedRow) or Peek(AcceptedRow,-2);
Load ... , Index(Lower(Field),'memory') as AcceptedRow From ... ;

Or
MVP
MVP

The first aspect doesn't seem problematic - seems like you need to use WildMatch(YourField,'*Memory*').

As for the second, without knowing anything about why you're keeping these specific lines, or what the structure of the contents are, it's not really possible to suggest the correct formula. Based strictly on your single example, you could perhaps use:

'Memory: '  & TextBetween(YourField,'Memory','scanner_dateofmanufacture')