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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

right(index) syntax

I have customerId like this:

a\10

b\20

c\30

d\40

e\50

f\60

g\70

h\80

i\90

I write this type of Syntax Right(CustomerId,2)as CustID    I got the result like this( I think this is correct)

CustID

10
20
30
40
50
60
70
80

90

But i want to use right and index function ( right(CustomerId, index(CustomerId, '\')+1) as custID) but  result is bad

\10

\20

\30

\40

\50

\60

\70

\80

\90

Syntax plz.( I want \ right side data)

Thanks

Madhu.

6 Replies
avinashelite

you can use subfield function for this , try like this

SUBFIELD(customerId,'\',2) as CustID

Anonymous
Not applicable
Author

you can try this as well:

=mid(CustomerID,3,4) as CustomerID where 3 show start position and 4 show end position

Anonymous
Not applicable
Author

may be this?

=right(CustomerId, index(CustomerId, '\'))

its_anandrjs
Champion III
Champion III

Better you can use Subfield function here

Ex:- =SubField(Col,'\',-1)

LOAD * Inline

[

Col

a\10

b\20

c\30

d\40

e\50

f\60

g\70

h\80

i\90

];

Regards,

Anand

Kushal_Chawda

try this

mid(CustID,Index(CustID,'\',1)+1)

HirisH_V7
Master
Master

Hi ,

Check this,

T:

LOAD *,

Mid(CustomerID,3,4) as ModCustomerID ,

SubField(CustomerID,'\',2) as ModCustomerID1,

TextBetween(CustomerID,'\','') as ModCustomerID2,

Right(CustomerID, Len(CustomerID)-Index(CustomerID, '\', 1)) as ModCustomerID3,

Right(CustomerID,2) as ModCustomerID4

INLINE [

CustomerID

a\10

b\20

c\30

d\40

e\50

f\60

g\70

h\80

i\90

];

Output:

Mid Subfield.PNG

Mostly You can use textbetween Or Subfield or right.

PFA,

Hope this helps,

-Hirish

HirisH