Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a database field called message that contains the following type of descriptive information below. I loaded it into QlikView, but I only need the text that says Reason: and the text after that word. The rest of the data is not relevant. As you can see the length is variable so you cannot precisely extract it. Any ideas how to do this? Thanks.
MessageTable
Order 28315349: Vendor assignment to vendor 47541 was deleted by user SUNIS. Reason: qa
Order 28315349: Vendor assignment to vendor 144775 was deleted by user SUNIS. Reason: rels
Order 28315349: Vendor assignment to vendor 66728 was deleted by user SUNIS. Reason: resd
MessageTable:
load * inline [
field
Order 28315349: Vendor assignment to vendor 47541 was deleted by user SUNIS. Reason: qa
Order 28315349: Vendor assignment to vendor 144775 was deleted by user SUNIS. Reason: rels
Order 28315349: Vendor assignment to vendor 66728 was deleted by user SUNIS. Reason: resd
];
expression
Right(field, len(field) -index(field, 'Reason') +1)
Does the below give you food for thought ?
= mid ( 'User SUNIS. Reason: qa', index('User SUNIS. Reason: qa', 'Reason') )
You can text it is a Text Box, and then replace 'User SUNIS. Reason: qa' with your field name.
MessageTable:
load * inline [
field
Order 28315349: Vendor assignment to vendor 47541 was deleted by user SUNIS. Reason: qa
Order 28315349: Vendor assignment to vendor 144775 was deleted by user SUNIS. Reason: rels
Order 28315349: Vendor assignment to vendor 66728 was deleted by user SUNIS. Reason: resd
];
expression
Right(field, len(field) -index(field, 'Reason') +1)
Massimo, thank you again for your help. Can you briefly explain how this works.
in the image you can see the original field, then 3 columns:
c1 index(field, 'Reason') position of 'Reason' in field
c2 len(field) -.c1 +1 length of the string I want as result
c3 rigth(field, c2) substring of field, consisting of the last c2 characters of field
That was very brilliant. Thanks.
I think Bill answer is better, mid with 2 parameters
Sorry, I didn't fully understand your answer.