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

1 Solution

Accepted Solutions
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.

View solution in original post

16 Replies
Kushal_Chawda

what exactly output you need?

Not applicable
Author

'-08.05.2014'

Kushal_Chawda

try like this

Subfield( Debit_Date,'-',2)

Not applicable
Author

Because the function returns 100000 (1 and 0) as characters to exclude in the string -08.05.2014

MarcoWedel

SubField(peek(debit_date),'-',2)

MarcoWedel

forgot the leading '-':

'-'&SubField(peek(debit_date),'-',2)

MarcoWedel

Or simply

Right(peek(debit_date),11)

if the date format is always the same

Not applicable
Author

Marco, thank you for response.

The problem is that rhe string is not always '100000-08.05.2014' it might be a longer  string, containing debt and its start_date.... it might be '100000-08.05.2014-50000-25.04.2014', for example. and i need to evaluate the first subfield (this is the sum of debt to be fully or partly repaid) and leave teh rest part of the string unchanged.

How can i solve it?

MarcoWedel

The SubField(peek(debit_date),'-',2) solution should work for those field values as well:

QlikCommunity_Thread_139750_Pic1.JPG.jpg

regards

Marco