Jump to content
Sign in to follow this  
R3vo

[SOLVED] Sort ListNbox

Recommended Posts

Hey folks,

 

I have got a listNbox which looks as follows:

DonK3Jg.jpg

 

Now I am looking for a way to sort the content of the different columns, e.g, Duration from lowest to highest, or Song names from A to Z. Unfortunately there doesn't seem to be lnbSort command.

 

My first idea was to simply put all the data for each track into an array like so:


 

Spoiler

 

[["Arma Magna",175,"Undefined"],["Arma Vera",215,"Undefined"],["Black Ops",246,"Undefined"],["Dogs of War",176,"Undefined"],["Field Track",102,"Undefined"],["Flashpoint Rearmed",212,"Undefined"],["Paradise on Earth",175,"Undefined"],["Primo In Mortis",46,"Undefined"],["Second Assault",100,"Undefined"],["Seventh - Company",90,"Undefined"],["Street Combat",82,"Undefined"],["Team Alpha",114,"Undefined"],["Team Bravo",110,"Undefined"],["Airborne D",114,"Undefined"],["Airborne",56,"Undefined"],["Arrival",252,"Undefined"],["Arrowhead",221,"Undefined"],["Arrowhead D",27,"Undefined"],["Coltan Blues D",74,"Undefined"],["Coltan Blues",181,"Undefined"],["Concrete Cell",259,"Undefined"],["Crude Oil",236,"Undefined"],["Dancing Scimitar",159,"Undefined"],["Death from Above",176,"Undefined"],["Goodmorning Takistan",162,"Undefined"],["Iron Mountain D1",72,"Undefined"],["Iron Mountain D2",74,"Undefined"],["Iron Mountain V",40,"Undefined"],["Iron Mountain",166,"Undefined"],["Night Visions",123,"Undefined"],["Nightlife",176,"Undefined"],["Revolver Jam",134,"Undefined"],["Warmongers",140,"Undefined"],["Zargabad Market",102,"Undefined"],["Crimson Lance",144,"Undefined"],["Drums",43,"Undefined"],["Jackals",53,"Undefined"],["Through the Valley",44,"Undefined"],["Utrinque Paratus",44,"Undefined"],["War Pipes",65,"Undefined"],["Abandoned Battlespace",111,"Undefined"],["Badlands",137,"Undefined"],["Chernarussian Anthem",129,"Undefined"],["Close Qarter Combat",188,"Undefined"],["Cobalt",43,"Undefined"],["Cold Wind",153,"Undefined"],["Dead Forest",64,"Undefined"],["Debriefing",104,"Undefined"],["Defcon Three",38,"Undefined"],["Eastern Eggs - Killing Machines",200,"Undefined"],["Electronic Warfare",76,"Undefined"],["First to Fight",119,"Undefined"],["Ghost Waltz",113,"Undefined"],["Harvest Red",78,"Undefined"],["Indian Summer",102,"Undefined"],["Insertion",105,"Undefined"],["Khe Sanh Riff",211,"Undefined"],["Large Scale Assault",42,"Undefined"],["Last Man Standing",63,"Undefined"],["Logistics",148,"Undefined"],["Manhatten",101,"Undefined"],["Marauder Song",68,"Undefined"],["Morning Sortie",55,"Undefined"],["Movement to Contract",81,"Undefined"],["Organ Works",69,"Undefined"],["Reforger",155,"Undefined"],["Reinforcements",88,"Undefined"],["Rise of the Fallen",89,"Undefined"],["Sharping Knives",180,"Undefined"],["The Movement",72,"Undefined"],["Vague Shapes",219,"Undefined"],["Valentine",86,"Undefined"],["Warpath",143,"Undefined"],["Deception",77,"Undefined"],["Escalation",57,"Undefined"],["Ghost Town",180,"Undefined"],["Ground Zero",193,"Undefined"],["Nomansland",197,"Undefined"],["Termination",130,"Undefined"],["Walk",200,"Undefined"],["The Fallen",150,"Undefined"],["Suppression",37,"Undefined"],["Soviet Theme",13,"Undefined"],["Snow Blades",217,"Undefined"],["The Fallen",262,"Undefined"],["Seventh - Lifeless",271,"Undefined"],["Seventh - I am gonna fly",244,"Undefined"],["Seventh - Decide",237,"Undefined"],["Secret",214,"Undefined"],["Ocean",13,"Undefined"],["Mixdown",16,"Undefined"],["March Hell",75,"Undefined"],["Arma Cold War Assault - Main Theme",258,"Undefined"],["Hunt",53,"Undefined"],["Heroes",178,"Undefined"],["Frost",69,"Undefined"],["Decisions",63,"Undefined"],["Dark Side",178,"Undefined"],["Casualties of War",59,"Undefined"],["Armor",56,"Undefined"],["Amen",61,"Undefined"],["Resistance Track 1a",65,"Undefined"],["Resistance Track 1b",33,"Undefined"],["Resistance Track 2",177,"Undefined"],["Resistance Track 3",46,"Undefined"],["Resistance Track 4",66,"Undefined"],["Resistance Track 5",66,"Undefined"],["Resistance Track 6",36,"Undefined"],["Resistance Track 7",45,"Undefined"],["Resistance Track 8",62,"Undefined"],["Resistance Track 9",79,"Undefined"],["Resistance Track 10",68,"Undefined"],["This Is War",162.8,"Undefined"],["This Is War a",74.31,"Undefined"],["This Is War b",66.92,"Undefined"],["Main Menu",128.93,"Undefined"],["Proteus",94.14,"Undefined"],["Combined Arms",96.79,"Action"],["Action Dark 2",150.65,"Action"],["Action Dark",111.99,"Undefined"],["Taking Kavala",86.41,"Action"],["Down at the Girina Bay",60,"Undefined"],["The East Wind - Alternative 1",189.7,"Stealth"],["The East Wind",184.72,"Undefined"],["The East Wind - Alternative 2",96.01,"Undefined"],["Solar Power",113.48,"Undefined"],["Night percussions",190.51,"Undefined"],["Night ambient",204.05,"Stealth"],["Car and Heli",110.77,"Undefined"],["Underwater 2",97.67,"Calm"],["Underwater 1",96,"Undefined"],["On The Road",88,"Calm"],["Track01_Proteus",94.14,"Undefined"],["Track02_SolarPower",113.49,"Undefined"],["Track03_OnTheRoad",88,"Undefined"],["Track04_Underwater1",96,"Undefined"],["Track05_Underwater2",97.67,"Undefined"],["Track06_CarnHeli",110.77,"Undefined"],["Track07_ActionDark",112,"Undefined"],["Track08_Night_ambient",204.04,"Undefined"],["Track09_Night_percussions",190.5,"Undefined"],["Track10_StageB_action",96.8,"Undefined"],["Track11_StageB_stealth",184.72,"Undefined"],["Track12_StageC_action",86.41,"Undefined"],["Track13_StageC_negative",60,"Undefined"],["Track14_MainMenu",128.93,"Undefined"],["Track15_MainTheme",162.81,"Undefined"],["Stage A: Lead Track 01 (Conquistador)",96.04,"Calm"],["Stage A: Lead Track 02 (Aegis Blues)",116.71,"Action"],["Stage A: Lead Track 02 (Aegis Blues - Alternative 1)",53.39,"Undefined"],["Stage A: Lead Track 02 (Aegis Blues - Alternative 2)",62.04,"Undefined"],["Stage A: Lead Track 03 (Survive the Hard Part)",137.94,"Undefined"],["Stage A: Lead Track 03 (Survive the Hard Part - Alternative)",22.68,"Undefined"],["Stage A: Event Track 01 (Fragmented)",28.54,"Undefined"],["Stage A: Event Track 01 (Fragmented - Alternative)",28.45,"Undefined"],["Stage A: Event Track 02 (Horizon Scan)",36.46,"Calm"],["Stage A: Event Track 02 (Horizon Scan - Alternative)",36.08,"Undefined"],["Stage A: Event Track 03 (Chemistry of War)",35.91,"Action"],["Stage A: Event Track 03 (Chemistry of War - Alternative)",35.17,"Undefined"],["Stage B: Lead Track 01 (Adapt)",135.03,"Action"],["Stage B: Lead Track 01 (Adapt - Alternative)",85.5,"Undefined"],["Stage B: Lead Track 02 (Exit Strategy)",179.11,"Action"],["Stage B: Lead Track 02 (Exit Strategy - Alternative 1)",70.36,"Undefined"],["Stage B: Lead Track 02 (Exit Strategy - Alternative 2)",117,"Undefined"],["Stage B: Lead Track 03 (Beyond Recognition)",123.2,"Stealth"],["Stage B: Lead Track 03 (Beyond Recognition - Alternative 1)",60.66,"Undefined"],["Stage B: Lead Track 04 (Canton Protocol)",132.25,"Action"],["Stage B: Event Track 01 (Resist)",36.11,"Calm"],["Stage B: Event Track 01 (Resist - Alternative)",28.23,"Undefined"],["Stage B: Event Track 02 (Ambush)",22.22,"Stealth"],["Stage B: Event Track 02 (Ambush - Alternative)",22.45,"Undefined"],["Stage B: Event Track 03 (Recon)",29.68,"Stealth"],["Stage B: Event Track 04 (Radio Silence)",44.58,"Stealth"],["Stage B: Event Track 04 (Radio Silence - Alternative 1)",40.52,"Undefined"],["Stage B: Event Track 03 (Recon - Alternative)",30.25,"Undefined"],["Stage B: Ambient Track 01 (Signal Lost)",69.49,"Stealth"],["Stage B: Background Track 01 (The Hunt)",126.84,"Stealth"],["Stage C: Lead Track 01 (Back on Stratis)",93.86,"Calm"],["Stage C: Lead Track 02 (LZ hot)",96.11,"Action"],["Stage C: Lead Track 03 (The Trap)",146.66,"Stealth"],["Stage C: Lead Track 04 (In the Open)",128.56,"Action"],["Stage C: Lead Track 05 (Revenge)",86.85,"Action"],["Stage C: Lead Track 06 (Win)",131.79,"Action"],["Stage C: Lead Track 06 (Win - Alternative 1)",66.01,"Action"],["Stage C: Event Track 01 (Farewell Altis)",38.77,"Stealth"],["Stage C: Event Track 02 (Broken Barricade)",47.22,"Action"],["Stage C: Event Track 02 (Broken Barricade - Alternative 1)",29.54,"Action"],["Stage C: Event Track 03 (Unforeseen Perdition)",87.66,"Calm"],["Stage C: Background Track 01 (Alone)",96,"Stealth"],["Stage C: Background Track 02 (Just Another Day)",97.87,"Calm"],["Stage C: Background Track 03 (Altis Requiem)",148.03,"Calm"],["Stage C: Background Track 04 (Assembly)",79.65,"Stealth"],["C_EA_RadioBroadcast1",41.73,"Action"],["C_EA_RadioBroadcast2",37.7,"Action"],["C_EA_RadioMusic1",52.22,"Action"],["C_EA_RadioMusic2",72.01,"Action"],["RadioAmbient1",17.4,"Undefined"],["RadioAmbient2",9.77,"Undefined"],["RadioAmbient3",11.08,"Undefined"],["RadioAmbient4",6.83,"Undefined"],["RadioAmbient5",9.06,"Undefined"],["RadioAmbient6",6.56,"Undefined"],["RadioAmbient7",5.41,"Undefined"],["RadioAmbient8",11.64,"Undefined"],["RadioAmbient9",7.73,"Undefined"],["RadioAmbient10",10.73,"Undefined"],["RadioAmbient11",5.57,"Undefined"],["RadioAmbient12",18.47,"Undefined"],["RadioAmbient13",6,"Undefined"],["RadioAmbient14",7.21,"Undefined"],["RadioAmbient15",7.84,"Undefined"],["RadioAmbient16",11.42,"Undefined"],["RadioAmbient17",6.24,"Undefined"],["RadioAmbient18",9.68,"Undefined"],["RadioAmbient19",10.42,"Undefined"],["RadioAmbient20",6.05,"Undefined"],["RadioAmbient21",3.59,"Undefined"],["RadioAmbient22",4.67,"Undefined"],["RadioAmbient23",8.27,"Undefined"],["RadioAmbient24",8.23,"Undefined"],["RadioAmbient25",9.92,"Undefined"],["RadioAmbient26",7.97,"Undefined"],["RadioAmbient27",15.25,"Undefined"],["RadioAmbient28",12.63,"Undefined"],["RadioAmbient29",19.18,"Undefined"],["RadioAmbient30",8.86,"Undefined"],["Fallout",207.05,"Undefined"],["Defcon",193.23,"Undefined"],["Wasteland",194.88,"Undefined"],["SkyNet",233.64,"Undefined"],["MAD",198,"Undefined"],["radio_music",151.46,"Undefined"],["Zeus Theme",182.57,"Undefined"],["Mission Accomplished",12.57,"Undefined"],["Mission Failed",13.84,"Undefined"],["Mission Accomplished (Zeus)",14.16,"Undefined"],["This is War (VR Remix)",164.8,"Action"],["This is War (VR Remix - loop)",32.04,"Calm"],["Evolution",242.28,"Action"],["Epic Split",61.28,"Calm"],["This is War (Heli Remix)",164,"Undefined"],["This is War (Marksmen Remix)",158,"Undefined"],["Marksmen DLC: Lead Track 02 (Into the Sun)",171.54,"Undefined"],["Marksmen DLC: Lead Track 03 (Marksmen)",130.36,"Calm"],["This Is War (Apex Remix)",176,"Action"],["This Is War (Apex Remix) - Part 1",50.86,"Action"],["This Is War (Apex Remix) - Part 2",71.83,"Action"],["This Is War (Apex Remix) - Part 3",78.41,"Action"],["An Unknown Enemy",155.96,"Action"],["No Time For Questions",188.58,"Action"],["This Is War (Apex Remix - Alternative 1)",123.54,"Action"],["Through The Jungle",111.66,"Stealth"],["Through The Jungle - Part 1",53.74,"Stealth"],["Through The Jungle - Part 2",72.22,"Stealth"],["Welcome To Tanoa",142.78,"Stealth"],["Welcome To Tanoa - Part 1",32.54,"Stealth"],["Welcome To Tanoa - Part 2",40.33,"Stealth"],["Welcome To Tanoa - Part 3",42.7,"Stealth"],["Welcome To Tanoa - Part 4",78.71,"Stealth"]]

 

 

 

 

And then sort the array either by duration, song name or theme. But again, there is no "out of the box" function which can do that (Or at least I don't know one)

 

Any help would be appreciated!

Share this post


Link to post
Share on other sites

I found a solution myself. My first idea was actually correct.

 

The solution looks as follows:

 

Collect all the data like in the spoiler above. Afterwards I can sort it with BIS_fnc_sortBy.


 

([_musicArray,[],{_x select 1},"ASCEND"] call BIS_fnc_sortBy);//Sorts by duration

([_musicArray,[],{_x select 0},"ASCEND"] call BIS_fnc_sortBy);//Sorts by song name

([_musicArray,[],{_x select 2},"ASCEND"] call BIS_fnc_sortBy);//Sorts by theme

 

Share this post


Link to post
Share on other sites
3 minutes ago, killzone_kid said:

There is lnbSort command, just not documented on BIKI

control lnbSort [col, order]

 

Damn, that would have saved alot of time :D Thanks for the info.

Share this post


Link to post
Share on other sites
8 minutes ago, R3vo said:

Damn, that would have saved alot of time :D Thanks for the info.


there is also lnbSortByValue

Share this post


Link to post
Share on other sites

lnbSort works perfectly, however there is something wrong when sorting numbers. Instead of sorting them from lowest to highest or vise versa, it sorts them according to the beginning number.

 

99,98,9,89,88,8.....

 

Is that intended?

Share this post


Link to post
Share on other sites
19 minutes ago, killzone_kid said:


They are not numbers they are strings

You are right. My bad.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×