Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Drop all characters after string is detected in field

Hi,

After a lot of trial, error and searching the forums i cannot seem to come with a conclusion to my issue. If anyone can help that would be greatly appreciated.

I'm trying to drop all characters (numeric or non-numeric) after a word in a field is detected:

I want to be able to drop EVERYTHING after "router" is found in the field resource and keep everything before it

eg.

field name:

  • resource

field values:

  • CA-E-router123.cisco
  • AP-V-router2.cisco
  • ME-UL-router72.cisco

desired result:

  • CA-E-router
  • AP-V-router
  • ME-UL-router

Thanks in advance!

1 Solution

Accepted Solutions

Re: Drop all characters after string is detected in field

subfield([resource],'router',1) & 'router'


talk is cheap, supply exceeds demand
3 Replies

Re: Drop all characters after string is detected in field

subfield([resource],'router',1) & 'router'


talk is cheap, supply exceeds demand
Employee
Employee

Re: Drop all characters after string is detected in field

Testing if 'router' is present

=if(Index(resource,'router')>0,Left(resource,Index(resource,'router')-1)&'router',resource)

Not applicable

Re: Drop all characters after string is detected in field

Thank you Gysbert! That was a quick, easy solution.

Community Browser