Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Search String

Hello All,

How are you?

I have a simple question this time.

I want to search the following strings from the right to find the price. The price value is concatenated with the item id in this manner.

Item_Price:

40637_123ABC_400

40644_1457_2300

40651_12_23005

So all values after the second "_" (underscore) is the price. And all the value before the first underscore "_" is the Julian date

So please suggest how to use the "Right" or Trim function.

Thanks in advance,

Bikash

Tags (4)
1 Solution

Accepted Solutions
Not applicable

Re: Search String

Hi Angus,

Thank you very much.

I got it how the result would look like.

Thanks & Regards,

Bikash

7 Replies
gussfish
Contributor II

Re: Search String

Hi Bikash,

the answer is that you don't want to use either function! Instead, use

subfield(str,'delimiter',n). This breaks-up the string str into

substrings at every occurence of 'delimiter', and returns the (n)th

substring.

So, in your example, you want subfield(Item_Price,'_',2).

Angus.

Not applicable

Re: Search String

Hi Angus,

Thank you very much.

I got it how the result would look like.

Thanks & Regards,

Bikash

gussfish
Contributor II

Re: Search String

Hi Bikash,

my previous post assumed that your Item_Price would always have the same

number of underscores in it. If this is not the case, and you need to

find the remainder of the string after the last underscore, then use

index(Item_Price, '_', -1 ) to find the position of the last underscore;

then you can use mid() to extract from after that.

Angus.

Not applicable

Re: Search String

Angus

I have the above issue,

Can you please help ?

I have used the following to find each of the ',' , now I would like the text either side

index([Rejection Reasons], ',', -1 )


Can you offer guidence please ?

Thanks,
A

Not applicable

Search String

Meant to say there are multiple ','

jduenyas
Contributor III

Re: Search String

Try this:

Left part = mid([Rejection Reasons],1,index([Rejection Reasons],',',-1)-1)

Or  Left Part = left(([Rejection Reasons],index([Rejection Reasons],',',-1)-1)

Right part = mid([Rejection Reasons],index([Rejection Reasons],',',-1)+1,len([Rejection Reasons]))

Not applicable

Re: Search String

Thanks jduenyas

Community Browser