Dynamic looping

Hello KNIMErs,

I have a problem that could be shown as follows:

  • Max number of elements: 4.
    It is dynamic value >1 set in th initial ‘Variable Creator’ node.

  • Expected outcome: the following strings
    1 out of 4
    2 out of 4
    3 out of 4
    4 out of 4

    1 out of 3
    2 out of 3
    3 out of 3

    1 out of 2
    2 out of 2

where separating lines are for better visibility only.

With combination of ‘Counting Loop Start’ and ‘Variable Condition Loop End’

I’m able to get the first sub-set of expected outcome.
image

However, I’m not sure how to decrease the max number of elements by 1 and run the loop again, and again. What would you suggest?

Thank you in advance!

Could you share your current workflow?

1 Like

Please find attached, @rfeigel
X_out_of_Y.knwf (82.1 KB)

Try this:
X out of Y rev 1.knwf (82.2 KB)


3 Likes

Thank you @rfeigel, your workflow is a solution to my challenge!

Hi there,
I would try to avoid double loops as they can get very slow if the number of iterations increases.

Maybe this one might help:

X out of Y

2 Likes

Hi @ActionAndi
Your workflow is really elegant, I like it, and - the most important - produces expected results.
Sorry for not marking your workflow as solution, but @rfeigel 's proposal produces expected results as well.

1 Like

No worries! Next time I’ll be quicker :smiley:

1 Like

@ActionAndi thanks to your proposal, I have overcome another challenge!
I would give double-like to your post, if only that would be possible :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.