Page 1 of 1


Posted: 29 Jul 2014 21:33
by plasticmagnet
I want to add upcounting numbers to an other variable. im using a for-loop...

s = "something";
firstNumber = 1;
lastNumber = 10000;
currentNumber = 0;
list = newList();

for (currentNumber in [firstNumber to lastNumber])
{ addElement(list, s + currentNumber); log(s + currentNumber)

Now how to do it if value lastNumber > 10000?
On my device it throws error somewhere after 10000.

Anyone an idea?

Note: tested while-loop with same result.

Re: Script?

Posted: 30 Jul 2014 18:27
by Martin

There's an artificial limit to stop loops at 10000 iterations.
You could split the loop into multiple sequential loops, nesting loops should also work.

Code: Select all

for(i in [i to 10000])
   for(n in [1 to 10])
What are you trying to achieve? Creating lists with hundreds of thousands of entries might result in out of memory problems at some point.


Re: Script?

Posted: 30 Jul 2014 21:26
by plasticmagnet
I'm working on a little yahoo tool and need to create a .txt file that contains a list of numbered user names..


I think with your code it creates a list from 1 to 10000 then starts over again?

Re: Script?

Posted: 31 Jul 2014 16:57
by plasticmagnet
Even though im understanding the loop inside a loop i keep ending up in an infinity loop.

Any help is much appriciated.

Re: Script?

Posted: 01 Aug 2014 06:17
by plasticmagnet

s = "something";
list = ([1 to 10100]);
list = replaceAll(replace(replace(list=s+list, "[", ""), "]", "") ,"\\,\\s","\n\{s}");

Re: Script?

Posted: 01 Aug 2014 06:23
by Martin
I would probably create a flow that generates 10000 users at once appends the users to file and then generates the next 10000 users. The flow could repeat this process as many times as you like.
This procedure has the advantage that you can control the amount of used memory and don't need to generate tens of thousands of usernames into a list variable.

Flow Generate Usernames (please adjust the file in action Write to File)

The example generates 10 times 000 users. The current user id is stored in variable id which is incremented in the for-loop every time a user is added to the list.
The action Write to File uses the append option so it will append the same usernames again when you run the flow multiple times.

I also like your solution, which is much simpler :-) (it might cause memory problems when "something" and/or the list is very long)

Re: Script?

Posted: 01 Aug 2014 07:07
by plasticmagnet
Thanks sir,

I had something like that too, but found it was too slow. And too much code. Anyway, Thanks for this sweet app and for your time!