Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Highlighted
Partner
Partner

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

1 Solution

Accepted Solutions

Re: Generate a sequence in rows

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

];

2 Replies
mwoolf
Honored Contributor II

Re: Generate a sequence in rows

Re: Generate a sequence in rows

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

];