Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
joseduque
Partner
Partner

Values of a Range

Hi All,

I Have a question about a range field:

RealDestinyCounters
21/08/2018 2:23DFWB26-B30

 

I need to spli the counters field into the values that I have in the range  Example B26 - B30

Result Table:

RealDestinyCounters
21/08/2018 2:23DFWB26
21/08/2018 2:23DFWB27
21/08/2018 2:23DFWB28
21/08/2018 2:23DFWB29
21/08/2018 2:23DFWB30

 

Do you think it's possible to do in the script? 

 

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Something like this

Table:
LOAD *,
	 Prefix & (Start + IterNo() - 1) as Counters_New
While Start + IterNo() - 1 <= End;
LOAD *,
	 PurgeChar(SubField(Counters, '-', 1), '0123456789') as Prefix,
	 KeepChar(SubField(Counters, '-', 1), '0123456789') as Start,
	 KeepChar(SubField(Counters, '-', 2), '0123456789') as End;
LOAD Real,
	 Destiny,
	 SubField(Counters, ',') as Counters;
LOAD * INLINE [
    Real, Destiny, Counters
    21/08/2018 2:23, DFW, "A1-A2,B26-B30"
];

View solution in original post

4 Replies
sunny_talwar

Try something like this

Table:
LOAD *,
	 Prefix & (Start + IterNo() - 1) as Counters_New
While Start + IterNo() - 1 <= End;
LOAD *,
	 PurgeChar(SubField(Counters, '-', 1), '0123456789') as Prefix,
	 KeepChar(SubField(Counters, '-', 1), '0123456789') as Start,
	 KeepChar(SubField(Counters, '-', 2), '0123456789') as End;
LOAD * INLINE [
    Real, Destiny, Counters
    21/08/2018 2:23, DFW, B26-B30
    21/08/2018 2:23, DFW, BD26-BD30
];
joseduque
Partner
Partner
Author

Thanks, 

 It work! sorry to bother you but I encounter with one condition about this range, That in te Field I can have 2 different ranges like:

A1-A2,B26-B30

In that case how can I do?

Thank you

sunny_talwar

Something like this

Table:
LOAD *,
	 Prefix & (Start + IterNo() - 1) as Counters_New
While Start + IterNo() - 1 <= End;
LOAD *,
	 PurgeChar(SubField(Counters, '-', 1), '0123456789') as Prefix,
	 KeepChar(SubField(Counters, '-', 1), '0123456789') as Start,
	 KeepChar(SubField(Counters, '-', 2), '0123456789') as End;
LOAD Real,
	 Destiny,
	 SubField(Counters, ',') as Counters;
LOAD * INLINE [
    Real, Destiny, Counters
    21/08/2018 2:23, DFW, "A1-A2,B26-B30"
];

View solution in original post

joseduque
Partner
Partner
Author

Thanks it work