Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
John-SSI
Creator
Creator

Search Up

Hi Forum,

I got 2 fields in sam table, 

Data 1 (is an Article)
Data 2 (Is a freetext)

And then a got a table in Qlik

If Data 1 contains text "N2332" and Data 2  contains text "N2332" then i will present all the post contains this.

Example;

Date Art Place Stock Freetext
2024-11-07 N233245 ABD3 3 N2332
2024-11-06 N000034 DEC4 3 N2332
2024-11-06 N2332 DEC67 7 IR24553
         

 

So when i search in this new (Data1 (Art) and Data2 (Freetext)) i want all the hits when a search on this word N2332 above.

Doable?

Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

24 Replies
Qrishna
Master
Master

if i understand you correctly, you are looking  for way to search the value 'N2332 ' in multiple fields so called Art and Freetext, this can be don using wild search/ fuzzy search. if you do regular search it shows up only from one field with the exact match.

John-SSI
Creator
Creator
Author

Okay, how do i combine these 2 rows in script?

Alt(Art , Freetext) as Test

Or do i missing the search object in Qlik Qloud. I remeber in QlikView there was a searchobject there you can point ot the data to search.

? 🙂

Qrishna
Master
Master

The alt function returns the first of the parameters that has a valid number representation. If no such match is found, the last parameter will be returned. 

 

i believe you are looking for mapsubstring logic appied to two different fields. something like below:

2491376 - Search Up.PNG

MapText:
// Mapping table
Mapping
Load Code,
'{' & Flag & '}' as MapText
Inline [
Code, Flag
N2332, 1
];

Data:
Load *,
if(Column1 = 1 and Column2 = 1, 'Art, FreeText',
if(Column1 = 1, 'Art', if(Column2 = 1, 'FreeText', 0))) as Field_Flag;
Load *,
MapSubString('MapText', Art) as MappedText1,
TextBetween(MapSubString('MapText', Art), '{', '}') as Column1,
MapSubString('MapText', Freetext) as MappedText2,
TextBetween(MapSubString('MapText', Freetext), '{', '}') as Column2
Inline [
Date, Art, Place, Freetext
2024-11-07, N233245, ABD3, N2332
2024-11-06, N000034, DEC4, N2332
2024-11-06, N2332, DEC67, IR24553
];

//drop fields Column1, Column2, MappedText1, MappedText2;

exit script;

John-SSI
Creator
Creator
Author

Yeah, exact!

Qrishna
Master
Master

Updated my above post with code.

John-SSI
Creator
Creator
Author

Nice, i will test.

This first code:
Mapping
Load Code,
'{' & Category & '}' as MapText
I have a Excel where the data is so no inline. Category i don't have

 

Qrishna
Master
Master

provide the excel will update the code.

John-SSI
Creator
Creator
Author

 
Qrishna
Master
Master

MapText:
// Mapping table
Mapping
Load Code,
'{' & Flag & '}' as MapText
Inline [
Code, Flag
N2332, 1
];

Data:
Load *,
if(Column1 = 1 and Column2 = 1, 'Art, FreeText',
if(Column1 = 1, 'Art', if(Column2 = 1, 'FreeText', 0))) as Field_Flag;
Load *,
MapSubString('MapText', Art) as MappedText1,
TextBetween(MapSubString('MapText', Art), '{', '}') as Column1,
MapSubString('MapText', Freetext) as MappedText2,
TextBetween(MapSubString('MapText', Freetext), '{', '}') as Column2
;
LOAD Date,
Art,
Place,
Stock,
Freetext
FROM
[SampleData.xlsx]
(ooxml, embedded labels, table is Blad1);

 

exit script;