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: 
Not applicable

Extract a Value from Field after Character

Hello,

I have a field named QTY where it could be like:

  • 1,2k1000/3Ax1
  • 1,2k100/3x100
  • 1.2KV50/3AX10

What I need is to extract from that field the number that comes after the x (or it could be an X too).

For the examples shown, I should get the following:

  • 1
  • 100
  • 10

How could I do that?

Thank you!!!

---

I tried using SUBFIELD(QTY,'x',2).

I think it works, but I'd need to use the logic with SUBFIELD(QTY,'X',2) too.

1 Solution

Accepted Solutions
MarcoWedel

SUBFIELD(Upper(QTY),'X',2)

View solution in original post

6 Replies
demoustier
Creator
Creator

you can try

right('Field',index('Field',or('x','X'),-1)

PS: not sure for the or('x','X')

mphekin12
Specialist
Specialist

What if you try something like this:

if(isnull(SUBFIELD(QTY,'x',2)),

     SUBFIELD(QTY,'X',2),

     SUBFIELD(QTY,'x',2)

)

mphekin12
Specialist
Specialist


Hope the attached file helps!

maxgro
MVP
MVP

right(QTY , len(QTY ) - index(upper(QTY ), 'X') )

Not applicable
Author

EDIT:

I didn't read the 'X' problem.

I've tryed this:

LET vTEST = '1,2k1000/3Ax1';

LET vRESULT = TextBetween (Replace(vTEST,'x', 'X'),'X','');

And it worked.

So:

To solve your problem you could 'create' a new field in that table using:

TextBetween (Replace(YourField,'x', 'X'), 'x', '' ) AS ValueAfterX;

Good Luck!

MarcoWedel

SUBFIELD(Upper(QTY),'X',2)