Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
QS21
Contributor III
Contributor III

strings in qliksense

Hi Team,

I have a filed values as below:

NAME

A1 is good,B1 is good, c1 is good

A1 is good

B1 is good, A1 is good,

C1 is good, B1 is good, A1 is good

B1 is good

 

Now, I want to create a field which will have values as below:

A1

B1

C1

so, I can write a count logic and get count of A1 in group and single occurance ex: A1 = 1 (single) and A1= 3 (group)

Labels (7)
8 Replies
MadhuriReddy
Contributor III
Contributor III

Hi,

Create a subfield with field Name. Subfield(Name,' ',1) as xyz

 

MadhuriReddy
Contributor III
Contributor III

Hi,

Create a subfield with field Name. Subfield(Name,' ',1) as xyz

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You could SubField() to split NAME by "," and then SubField() again to get the first word in each. For example:

Data:
LOAD *, RecNo() as RecId Inline [

NAME
"A1 is good,B1 is good, c1 is good"
"A1 is good"
"B1 is good, A1 is good,"
"C1 is good, B1 is good, A1 is good"
"B1 is good"
]
;
Labels:
LOAD
  RecId,
  SubField(Phrase, ' ',1) as Label
where len(Phrase)
;
LOAD
  RecId,
  Trim(SubField(NAME, ',')) as Phrase
Resident Data
; 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

sidhiq91
Specialist II
Specialist II

@QS21 Please see the below code:

NoConcatenate
Temp:
Load *, RecNo() as RecId

inline [
NAME

A1 is good,B1 is good, c1 is good

A1 is good

B1 is good, A1 is good

C1 is good, B1 is good, A1 is good

B1 is good

] (delimiter is '|');


NoConcatenate
Temp1:
Load SubField(New_Name,' ',1) as Newfield,
RecId
;

Load RecId,
trim(SubField(NAME,',')) as New_Name

Resident Temp;

Drop table Temp;

Exit Script;

 

QS21
Contributor III
Contributor III
Author

Hi Rwunderlich, 

Thanks! but I need it to work dynamically. coz, I am trying to create a filed where if I select A1, I should get all occurrences in the tables no matter which position A1 comes (first or middle or last).

QS21
Contributor III
Contributor III
Author

Hi Sidhiq,

Thank you but kindly note that I am not looking for only first occurrences. I was able to get the list of all first strings but when I select B1 it will only give me list of B1s which came as first string, it will not give anything if B1 is in middle or last position

 

tresesco
MVP
MVP

Have a look at substringcount()

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you want all the words, then remove the position argument "1" from the Subfield. eg

SubField(Phrase, ' ') as Label

-Rob