Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

purge function- where error?

Hello,

Could anyone tell me, plese, why

PurgeChar(peek(debit_date), SubField(peek(debit_date),'-',1))

returns '-8.5.24',

if the incoming string is '100000-08.05.2014'?

Thanks in advance

16 Replies
Not applicable
Author

Carlo Belletti, thank you for responce. Can you kindly explain how does it get '-8.5.24' in such way? and how to gwet the substring without first substring in such a way?

regards,

Alexa

Not applicable
Author


Hi,

it is giving correct answer only

here you have

if the incoming string is '100000-08.05.2014'

PurgeChar(peek(debit_date), SubField(peek(debit_date),'-',1))

returns '-8.5.24',

keepChar(peek(debit_date), SubField(peek(debit_date),'-',1))

it will give 100000

subfield(peek(debit_date),'-',1))  it will give 100000

subfield(peek(debit_date),'-',2))  it will give 08.05.2014

according to your requirement you can use these scenarios

Not applicable
Author

oh, yeah... now I understand my error... I thougth it works like subfielb, but extracts ... didnt mentioned that it takes away all the symbols =(

thanks for explanation/

Only question is why should

keepChar(peek(debit_date), SubField(peek(debit_date),'-',1))

give 100000 and not 1000000001?

Not applicable
Author

If I have figured out correctly your problem, i think a possible solution is:

Step1: index the '-' character with the index function

in your specified case index function in debit_date field, for '-' character returns 7

INDEX FUNCTION: index(debit_date,'-')

you have to use this value in the FINAL FUNCTION..

Step2

use the result of the first step to select only the string partyou need (in your case date part)

FINAL FUNCTION: mid(debit_date,index(debit_date,'-'))

This method solve the problem of the debit string lenght.

Not applicable
Author

Yeah you are right that keepchar syntax will give 1000000001

it will keep all the characters what we gave values to keep in the list

Not applicable
Author

Thank you, Carlo Belletti, for an interesting solution!

regards,

Alexa

Not applicable
Author

thank you once more Carlo Belletti because i've just understood, that YOUR answer is correct=)