|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
How to sort Elements within a Group using a Method?
Gents,
I have a grouping that looks like this: Code:
key1 Item1, Item2, Item3, ... key2 Item1, Item2, Item3, ... Code:
Text = Method(Var1, Item, Var3) Any help would be greatly appreciated. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#2
|
||||
|
||||
By "grouping" you mean the result of a call to GroupByMethod()? That's actually a java.util.Map.
So you're saying you want the Map keys sorted into some order? Or you don't care about the key order, but you want the items under each key sorted? In the latter case, sort the original array or list before calling GroupByMethod(), and it will preserve the relative ordering of the items in each subgroup. The method you pass to Sort() or SortLexical() must have the signature int Method(item1, item2 [, ... ] ) As the docs indicate, if you pass in extra arguments to Sort(), they'll be pass through to the method like so: Sort(data, descending, "Method", x, y, z, ...) Method(item1, item2, x, y, z, ...) If your method doesn't match that signature, you'll need to write a wrapper function for it in Java that does. In case it's not clear from the docs, the difference between Sort() and SortLexical() is that Sort() sorts items according to their actual type, whereas SortLexical() always sorts them as strings. So if you apply SortLexical() to a list of integers, for instance, the result will be along the lines of 1, 10, 11, 12, ..., 2, 20, 21, 21, ..., etc. Unless you specifically want that, use Sort() instead of SortLexical().
__________________
-- Greg |
#3
|
||||
|
||||
Greg,
The grouping is made by calling new_java_util_HashMap and then AddToGrouping() so I suppose I have a Map? (Sorry my java terminology is so poor.) I figured out how to sort the keys but I haven't figured out how to sort the Items for each key. When I call AddToGrouping() the Items are in no particular order. Unfortunately for me the Method I need to use to sort them does not have the right signature and writing a wrapper is currently beyond my skills. But I learned programming in the dark ages and do remember how to code a bubble sort I do need to bite the bullet and learn how to make .jar files that I can use from within studio. What's your recommendation for the development environment? Thanks for the tip on Sort() vs. SortLexical(). I already figured that one out, the hard way. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Strange chaning of elements inside grouping | PLUCKYHD | SageTV Studio | 3 | 08-12-2009 12:07 PM |
Viewing Photoshop Elements Catalog With MVP | nwboater | SageTV Customizations | 20 | 12-23-2008 10:11 AM |
can I group all recorded movies into a MOVIES group | Deacon Crusher | SageMC Custom Interface | 5 | 06-05-2008 12:22 PM |