Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jsanchezh
Partner - Creator
Partner - Creator

Generate a sequence in rows

Hello everyone,

I'm facing a trouble trying to generate new rows for a content between two values. I have the following simple example:

VALUE1VALUE2NUMBEROFVALUESPREFIX
ES001ES0044ES
CS002CS0032CS

And I would like to obtain the following result

VALUE1VALUE2NUMBEROFVALUESRESULT
ES001ES0044ES001
ES001ES0044ES002
ES001ES0044ES003
ES001ES0044ES004
CS002CS0032CS002
CS002CS0032CS003

Does anybody know how can I get this?

Thank you very much

Kind regards

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this

Table:

LOAD VALUE1,

  VALUE2,

  NUMBEROFVALUES,

  PREFIX & Num(Start + IterNo()-1, '000') as RESULT

While Start + IterNo()-1 <= End;

LOAD *,

  KeepChar(VALUE1, '0123456789') * 1 as Start,

  KeepChar(VALUE2, '0123456789') * 1 as End;

LOAD * INLINE [

    VALUE1, VALUE2, NUMBEROFVALUES, PREFIX

    ES001, ES004, 4, ES

    CS002, CS003, 2, CS

];

View solution in original post

2 Replies
m_woolf
Master II
Master II

sunny_talwar
MVP
MVP

May be this

Table:

LOAD VALUE1,

  VALUE2,

  NUMBEROFVALUES,

  PREFIX & Num(Start + IterNo()-1, '000') as RESULT

While Start + IterNo()-1 <= End;

LOAD *,

  KeepChar(VALUE1, '0123456789') * 1 as Start,

  KeepChar(VALUE2, '0123456789') * 1 as End;

LOAD * INLINE [

    VALUE1, VALUE2, NUMBEROFVALUES, PREFIX

    ES001, ES004, 4, ES

    CS002, CS003, 2, CS

];