Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
psk180590
Contributor III

Check for particular value in a text field.

Hello All,

 

I have the following values in my data.

TEXT:

A01// External Sales Data

A13// TV Campaign

No Activity

 

Here, i would like to check if the values in TEXT have // and then extract the first 3 values.

From the above mentioned data i would like to only display A01 and A13.

 

TIA

Sai.

Labels (1)
4 Replies
sergio0592
Valued Contributor II

Re: Check for particular value in a text field.

Hi,

It works with :

TEXT:
load if (wildmatch(Field,'*//*'), SubField(Field,'//',1),'') as Field2
inline [
Field
A01// External Sales Data
A13// TV Campaign
No Activity];

Re: Check for particular value in a text field.

Perhaps this?
If(istext(field), sibfield(field, '//', 1), field) as new
Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
MindaugasBacius
Valued Contributor III

Re: Check for particular value in a text field.

I would prefer using Index and Left functions. Take a look:

LOAD *
	,If(Index(text, '//'), Left(text, 3), null()) as Result
INLINE [
text
A01// External Sales Data
A13// TV Campaign
No Activity
];

This is your expected results:

 Screenshot_2.jpg

Also, I do advise you instead of Null() in If statement to you something that's easy to count and find.

If(Index(text, '//'), Left(text, 3), ':') as Result

 

psk180590
Contributor III

Re: Check for particular value in a text field.

Thanks all for you valubale suggestions.
For the same data i have found out that there is another Text field, now i have to check both the fields and then extract the Value if exists in either one of them.

Please, check the attached excel.

Value.PNG

 

 



In the first Column Text2 is Empty, Second one has Text Empty, Third one has both the Values same and the Fourth one has no Values.

TIA!!