Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Dawid2
Contributor II
Contributor II

Search in field

I have a table in which one column has a lot of data in every row. I'd like to do search option in this column, let's call it column A. I use input box to set text to variable. Later on I use button and action "Select in field" to search in the coulmn A for a value in this variable. It works well, but only when I input one word, it doesn't work for searching strings separated with spaces. And also I'd like to search in this column for this word but only if it's a part of value of certain parameter.

For example I have something like this: \"Sonderausführung\":\"Montage der oberen Kombiankerschiene 1419 mm
von hinten beginnend bis ca. Mitte Aufbau\";   

and something like this:  "Seitenwand links":"\"CPU Innenausstattungen\":\"Kombiankerschiene aufgesetzt , Einbauhöhen von Bodenauflage bis Mitte Schiene 529\";

And for example I want to search for word "Kombiankerschiene" but only if it's part of value in first example. So second value shouldn't be taken into account.

This is the code we have in our search string in button (vTest is a variable from our input box): 

='(' & SubField(SubField('*' & vTest & '*', wildmatch('*Sonderausführung\":\"*', vTest), -1), ';', 1) & ')'

Do you have any idea how to change it so it would work in the way we would like it to work?

Thank you in advance.

Labels (6)
2 Replies
marcus_sommer

The most interesting question is - are you able to get the wanted results by a direct search within this field? If not - you won't get it with extra complexity by the use of variables/triggers. In regard to complex searches is the following quite helpful: Compound Search - demystified - Qlik Community - 1494410

Beside this I think I would go another way by extracting and cleaning/preparing these information into multiple columns and/or rows and providing them to the users who just select there the wanted views. For example with an approach like this:

load *, rowno() as RowNo;
load *, subfield(Field2, 'SecondDelimiter', iterno()) as Field3, iterno() as IterNo2,
            substringcount('SecondDelimiter') + 1 as Counter
           while iterno() <= substringcount('SecondDelimiter') + 1;
load *, subfield(Field, 'FirstDelimiter', iterno()) as Field2, iterno() as IterNo,
            substringcount('FirstDelimiter') + 1 as Counter
           while iterno() <= substringcount('FirstDelimiter') + 1;
load Key, Field, recno() as RecNo;

Means beside extracting the information into multiple fields and rows you could also provide information how many items are there and which order they have and further more stuff.

Beside getting more valuable information I regard such approach as a better usability - even if there are then 3 / 6 / 8 list-boxes (some information might be also combined with expressions again) - because the user sees what happens by selecting anything and how the data are associated with each other and it would be faster and easier as going to the input-box and typing multiple words properly (spelling, right order, correct syntax).

Dawid2
Contributor II
Contributor II
Author

Thanks for your help and sorry for late response but we did it this way

 
Tab1:
LOAD
//KEY
    field1 & '-' &  field2 & '-' & field3 as %%KEY_Field,
  //DATA
   *;
 
Tab2:
LOAD 
    %%KEY_Field,
    field as newField
Resident Key_Field
Where WildMatch(field, '*\"Sonderausführung\"*') ;
 
 
Tab3:
LOAD
    %%KEY_Field,
    SubField(newField, ';') as field_SonderAusf
Resident Tab2;
DROP TABLE Tab2;
 
Tab4:
LOAD
    %%Key_Field,
    if(Left(field_SonderAusf, 20) ='\"Sonderausführung\"', field_SonderAusf) as field_Sonderausführung,
Resident Tab3;
DROP TABLE Tab3;
 
Result:
LOAD
    %%Key_Field,
    Concat(field_Sonderausführung, '||') as result.SonderAusf
RESIDENT Tab4
GROUP BY %%Key_Field;
DROP TABLE Tab4;