Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
Sort numbers from excel file
Moderator: Support
-
- Posts: 45
- Joined: 07 Jan 2017, 14:02
Sort numbers from excel file
hi there
Is there any simple way to sort numbers from small to big imported for example from excel sheet or text file?
also how to sort the numbers is there text linked to it? like team A score 50 point. Team B score 20 point etc.
Is there any simple way to sort numbers from small to big imported for example from excel sheet or text file?
also how to sort the numbers is there text linked to it? like team A score 50 point. Team B score 20 point etc.
-
- Posts: 172
- Joined: 03 Dec 2014, 15:46
-
- Posts: 45
- Joined: 07 Jan 2017, 14:02
Re: Sort numbers from excel file
I have think about this option ,but I need to sort values in ventuz not office.
So is there any tools in ventuz can do the job ?
So is there any tools in ventuz can do the job ?
-
- Posts: 290
- Joined: 18 Jan 2012, 11:36
- Location: Dubai, United Arab Emirates
- Contact:
Re: Sort numbers from excel file
That is a very specific task and usually needs to be customized to fit a specific need. You can use the C# node, input the values in it in an array and then sort the array there and output the values again. It's only a few lines of code to get it done. There is a C# array sort method for specifically that usage. https://msdn.microsoft.com/en-us/librar ... .110).aspx
-
- Posts: 45
- Joined: 07 Jan 2017, 14:02
Re: Sort numbers from excel file
thanks u-double-u and Christian Krix Schmidt but I am not programmer.
To be honest I need to recreate this scene in ventuz
https://youtu.be/RamDBQHU3tU?t=6m26s
It was created in other cg software I think.
So is there any other ideas ?
To be honest I need to recreate this scene in ventuz
https://youtu.be/RamDBQHU3tU?t=6m26s
It was created in other cg software I think.
So is there any other ideas ?
-
- Posts: 290
- Joined: 18 Jan 2012, 11:36
- Location: Dubai, United Arab Emirates
- Contact:
Re: Sort numbers from excel file
Oh my. That is a really complicated setup in that example for just 5 values. What if you have to sort 10 or 20 values?
So the best way of doing this - and being able to have any number of numbers/names to sort would be to use a little C# script. Would be perfect.
Without a script you could read out every cell and then start sorting them manually using little expressions. A lot of nodes for a very limited number of entries.
I would recommend a really simple alternative. Bind the Excel cells with the names fixed. First row in Excel is first row in Ventuz, 2nd is 2nd, etc. for all your names.
Go into Excel. You will be editing it anyway. Select all your names and values. From the Excel Data menu select Sort. Select which Column you want to sort by and the order of the output. Click OK. Press Save and Ventuz is updated as well.
Attached is a screenshot of Excel with the Sort menu open. Super simple and quick. No logic required in Ventuz.
Hope that helps to solve your problem.
Chris
So the best way of doing this - and being able to have any number of numbers/names to sort would be to use a little C# script. Would be perfect.
Without a script you could read out every cell and then start sorting them manually using little expressions. A lot of nodes for a very limited number of entries.
I would recommend a really simple alternative. Bind the Excel cells with the names fixed. First row in Excel is first row in Ventuz, 2nd is 2nd, etc. for all your names.
Go into Excel. You will be editing it anyway. Select all your names and values. From the Excel Data menu select Sort. Select which Column you want to sort by and the order of the output. Click OK. Press Save and Ventuz is updated as well.
Attached is a screenshot of Excel with the Sort menu open. Super simple and quick. No logic required in Ventuz.
Hope that helps to solve your problem.
Chris
-
- Posts: 45
- Joined: 07 Jan 2017, 14:02
Re: Sort numbers from excel file
Thanks Christian ,
but i need to do the sorting thing in ventuz not in excel.
So is there any suggestion about ventuz Tools that can help in doing this scene?
but i need to do the sorting thing in ventuz not in excel.
So is there any suggestion about ventuz Tools that can help in doing this scene?
-
- Posts: 290
- Joined: 18 Jan 2012, 11:36
- Location: Dubai, United Arab Emirates
- Contact:
Re: Sort numbers from excel file
Anything besides a script is equally cumbersome and limited like the Expression example in the youtube video. The best way is to open the Excel file in C# and parse it. I can highly recommend you either learn a bit about scripting or find someone who can help you with that. In the meantime, I created a rough solution for you. Attached is an archive with scene and Excel file. The scene reads out 8 rows of values and names from an Excel manually. I never programmed an Excel connection in C# and I didn't want to learn it just for this example. So I used regular nodes to read the data from Excel. That should make things easier for you as well. And there is a little C# script which sorts the data and outputs the result. The script is super basic and probably not very well coded. Doesn't really matter. It gets the job done. With the basic setup done you should be able to extend it if you need more than 8 values.
Hope that helps with your project.
Chris
Hope that helps with your project.
Chris
- Attachments
-
- ExcelSort.vza
- (18.42 KiB) Downloaded 223 times
-
- Posts: 45
- Joined: 07 Jan 2017, 14:02
Re: Sort numbers from excel file
thanks Chris
Re: Sort numbers from excel file
I haven't read everything but:
you can sort an Array without a script:
macke a new string expression
Edit custom Model->delete all inputs->create a new float array input named "NumbersArray"->create a bool Input named "Reverse".
add the following text as expression (including the brackets)
create a string splitter node and connect it to the output of the string expression
connect you array (int or float) to the NumbersArray of the string expression
works as well for string arrays (just change the float array to string array)
done
you now have a sorted array and with the reverse bool you can set it from ascending to descending
you can sort an Array without a script:
macke a new string expression
Edit custom Model->delete all inputs->create a new float array input named "NumbersArray"->create a bool Input named "Reverse".
add the following text as expression (including the brackets)
Code: Select all
{
Array.Sort(NumbersArray);
if(Reverse)Array.Reverse(NumbersArray);
return String.Join("\r\n",NumbersArray);
}
connect you array (int or float) to the NumbersArray of the string expression
works as well for string arrays (just change the float array to string array)
done
you now have a sorted array and with the reverse bool you can set it from ascending to descending