Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
joseduque
Partner - Contributor III
Partner - Contributor III

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 - Contributor III
Partner - Contributor III
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"
];
joseduque
Partner - Contributor III
Partner - Contributor III
Author

Thanks it work