katelynnm 1 Posted October 24, 2013 Report Share Posted October 24, 2013 (edited) I have a table with two columns. I want to take the table and reverse the entire thing. Example: This original table:-------------------| Dog | 1 |-------------------| Cat | 2 |-------------------| Bird | 4 |-------------------| Fish | 8 |------------------- Becomes:-------------------| Fish | 8 |-------------------| Bird | 4 |-------------------| Cat | 2 |-------------------| Dog | 1 |------------------- How do I do that?I tried this which worked but I want it to be in Decending order with Column 1 as the index, not ascending.plugin command("TableCommands.dll", "sort table", &positiveTable, 1) Edited October 24, 2013 by katelynnm Quote Link to post Share on other sites
LazyBotter 188 Posted October 24, 2013 Report Share Posted October 24, 2013 There is probably a better way to do it but this works: clear list(%Items) clear list(%Items2) clear table(&Table) clear table(&Temp_Table) add list to list(%Items, $list from text("Item1 Item2 Item3 Item4", " "), "Delete", "Global") add list to list(%Items2, $list from text("Item1 Item2 Item3 Item4", " "), "Delete", "Global") add list to table as column(&Table, 0, 0, %Items) add list to table as column(&Table, 0, 1, %Items2) divider set(#Row_Dec, $subtract($table total rows(&Table), 1), "Global") set(#Row, 0, "Global") loop($table total rows(&Table)) { set table cell(&New_Table, #Row_Dec, 0, $table cell(&Table, #Row, 0)) set table cell(&New_Table, #Row_Dec, 1, $table cell(&Table, #Row, 1)) decrement(#Row_Dec) increment(#Row) } Carl Quote Link to post Share on other sites
katelynnm 1 Posted October 24, 2013 Author Report Share Posted October 24, 2013 Hi Carl-thank you so much-that worked perfectly! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.