25-02-2014 09:16 PM
Can someone help a Mega novice understand how to use the GetSelection Sort option?
I am trying to retrieve application objects, and then sort them by shortname.
'MegaContext(Fields,Types)
dim root as MegaRoot
set root = getRoot
for each app in root.GetSelection("Select Application", [shortname:A])
print app.shortname
cnt = cnt + 1
next
print "Count:" & cnt
This does not work as written, and I am unsure what the syntax is for adding the sort option (shortname:A)
Suggestions?
Solved! Go to Solution.
27-02-2014 11:06 AM
'MegaContext(Fields,Types)
dim root as MegaRoot
set root = getRoot
for each app in root.GetSelection("Select Application", -1, "short name")
print app.shortname
cnt = cnt + 1
next
print "Count:" & cnt
just put -1 in frotn of the sorting attribute.
regards
26-02-2014 07:37 PM
Is there a way to specify a descending sort? In the documentation for GetCollection, it was mentioned that you could append A or D to the attribute name to have the sort be ascending or descending. However "shortname:A" or "shortname:D" returns an error.
26-02-2014 09:10 AM
'MegaContext(Fields,Types)
dim root as MegaRoot
set root = getRoot
for each app in root.GetSelection("Select Application", "short name")
print app.shortname
cnt = cnt + 1
next
print "Count:" & cnt
regards