In pull from list activity,I want the query condition is ORDER BY RAND() and ORDER BY num ASC,but,It did not work as pic settings,how could I achieve it? thanks1647796330(1).jpg
In pull from list activity,I want the query condition is ORDER BY RAND() and ORDER BY num ASC,but,It did not work as pic settings,how could I achieve it? thanks1647796330(1).jpg
Hi @Bing L, was one of Bing L's or Felix Möhlmann's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
That query seems to work fine for me. The tokens are created with labels in the order of GlobalTable1 (Col 1 => num). GlobalTable2 shows the order in which they were pulled.
Could you provide some more detail in what way the query doesn't work in your model?
thank you.
My goal is to pull 3 random numbers from 10 nunbers, but these 3 numbers must be arranged ORDER BY ASC
The query is applied to the list before something is pulled. Whereas you want to order the resulting array after pulling.
You could theoretically use multiple "Pull from List" in a row and use the pull from the previous one as a condition in the next, but this would introduce a bias toward higher numbers since some entries would be disqualified from being pulled after the first one.
Instead I would simply sort the resulting array after all entries are pulled. The code below is an implementation of a simple sorting algorithm (bubble sort) that you can use to do this. It assumes that "num" is a label on the entries that are pulled and that the pulled entries are assigned to "token.pulled".
Array pulled = token.pulled; for(int i = pulled.length; i > 1; i--) { for(int j = 1; j < i; j++) { if(pulled[j].num > pulled[j+1].num) { Variant memory = pulled[j]; pulled[j] = pulled[j+1]; pulled[j+1] = memory; } } }
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved