Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Christiann
Partner - Contributor III
Partner - Contributor III

Dynamic counter as result (part) of the repeat(...)-function

Hi all,

 

I'm looking for a solution to the following problem:

I need a counter that counts up within the result of the repeat(...) function.

As an example:
=repeat( X, 5 ) should return '12345' as the result.

What can X look like for this?

 

Best regards

Labels (1)
2 Solutions

Accepted Solutions
jpenuliar
Partner - Specialist III
Partner - Specialist III

look at Valueloop function:

Concat(distinct ValueLoop(1, 10),'',ValueLoop(1, 10))

View solution in original post

Christiann
Partner - Contributor III
Partner - Contributor III
Author

Hi,

here the complete solution:

concat( '<FirstPartOfText>' & valueloop( ExpForCounter ) & '<SecondPartOfText>' & valueloop( ExpForCounter ),
'<AdditionalPartOfText>', // this is important for the concat( ... ) function
valueloop( ExpForCounter ) ) // for correct sorting of the result

View solution in original post

4 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

look at Valueloop function:

Concat(distinct ValueLoop(1, 10),'',ValueLoop(1, 10))

Christiann
Partner - Contributor III
Partner - Contributor III
Author

Thank you for your reply.
Unfortunately, it doesn't quite solve the problem.

I need to concretize it.

X is a combination of text and consecutive number, so the result should be the following:

'abc1', 'abc2', 'abc3', 'abc4', 'abc5'

Christiann
Partner - Contributor III
Partner - Contributor III
Author

or more precisely, the result should be as follows:

'abc1 xyz1', 'abc2 xyz2', 'abc3 xyz3', 'abc4 xyz4', 'abc5 xyz5'

I need the number twice per repetition

Christiann
Partner - Contributor III
Partner - Contributor III
Author

Hi,

here the complete solution:

concat( '<FirstPartOfText>' & valueloop( ExpForCounter ) & '<SecondPartOfText>' & valueloop( ExpForCounter ),
'<AdditionalPartOfText>', // this is important for the concat( ... ) function
valueloop( ExpForCounter ) ) // for correct sorting of the result