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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help required in replacing the text

Hi All,

Please see the highlighted condition which will give the data from the sentence NUMBER OF INFECTIONS. But If there is a sentence as NUMBER OF INFECTIONS in the column DESCRIPTION then the malware name has to be Multiple Malware Name

If(Index(Description,'infections'),TextBetween(Description & '#','Number of infections:','#'),If(Index(Description,'Malware name:'),TextBetween(Description & '#','Malware name:','#'),TextBetween(Description & '#','Malware Name:','#'))) As [Malware Name],

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Instead of TextBetween(), then hardcode the value.

If(Index(Description,'infections'),'Multiple Virus',

    If(Index(Description,'Malware name:'),TextBetween(Description & '#','Malware name:','#'),TextBetween(Description & '#','Malware Name:','#'))) As [Malware Name]

View solution in original post

4 Replies
anbu1984
Master III
Master III

So if you have infections in Description field, you want to assign constant string "Multiple Malware Name" to [Malware Name]??

Anonymous
Not applicable
Author

Hi Anbu,

Thanks for replying.. Actually this script is made by you. Thanks again.

The actual script given by you is If(Index(Description,'Malware name:'),TextBetween(Description & '#','Malware name:','#'),TextBetween(Description & '#','Malware Name:','#')) As [Malware Name]

In some cases I dont have Malware name or Malware Name. Instead I am having 'Number of infections: 2'

So I made a script like below.

If(Index(Description,'infections'),TextBetween(Description & '#','Number of infections:','#'),

    If(Index(Description,'Malware name:'),TextBetween(Description & '#','Malware name:','#'),TextBetween(Description & '#','Malware Name:','#'))) As [Malware Name]

As a result I am getting 2 in the Malware Name column which is actually correct. But instead of 2 I want that to be 'Multiple Virus'

anbu1984
Master III
Master III

Instead of TextBetween(), then hardcode the value.

If(Index(Description,'infections'),'Multiple Virus',

    If(Index(Description,'Malware name:'),TextBetween(Description & '#','Malware name:','#'),TextBetween(Description & '#','Malware Name:','#'))) As [Malware Name]

Anonymous
Not applicable
Author

No words to express. That simple?

It is working perfectly... Thanks a ton..