Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how this expression works?

Load *, if(index(Code, ' '), subfield(Code, ' '), if(index(Code, '-'), subfield(Code, '-'), Code)) as Test

1 Solution

Accepted Solutions
PrashantSangle

Hi,

index(Code, ' '), subfield(Code, ' ')

Index() returns position of space if it returns true i.e. position value more than 0

then perform Subfield ()

Subfield() gives data of Code before space

for example

if code = abc cde

then index(Code,' ')     return 4

then Subfield(Code,' ') Operation Performs which return abc

if code = abc-cde

then second condition i.e. if(index(Code, '-'), subfield(Code, '-') perform

if code = abcde

then final else i.e. return all string

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

2 Replies
PrashantSangle

Hi,

index(Code, ' '), subfield(Code, ' ')

Index() returns position of space if it returns true i.e. position value more than 0

then perform Subfield ()

Subfield() gives data of Code before space

for example

if code = abc cde

then index(Code,' ')     return 4

then Subfield(Code,' ') Operation Performs which return abc

if code = abc-cde

then second condition i.e. if(index(Code, '-'), subfield(Code, '-') perform

if code = abcde

then final else i.e. return all string

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Hi expert,

as well as i have  araised one more  question expr2   please explain me that also