cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using the GetSelection Sort option

Solved
Occasional Contributor

Using the GetSelection Sort option

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?

Tags (3)
3 Replies
Regular Contributor

Re: Using the GetSelection Sort option

'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

Highlighted
Occasional Contributor

Re: Using the GetSelection Sort option

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 "shortnameSmiley Very Happy" returns an error.

Regular Contributor

Re: Using the GetSelection Sort option

'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