Scope of Query Objects
All query objects can be instantiated from PeopleCode only.
You can use this object anywhere you have PeopleCode—that is, in an application class, Application Engine PeopleCode, record field PeopleCode, and so on.
You can only instantiate a query object from a Session object. You must instantiate the Session object before you can instantiate a query object or query collection. Use the %Session system variable to connect to the existing session.
Local ApiObject &QueryList; Local ApiObject &MySession; &MySession = %Session; If &MySession <> Null Then /* connection is good */ /* Search for public queries of type QUERY, search both the name and*/ /* description for the pattern MyQ%, and do a case insensitive search */ &QueryList = &MySession.SearchPublicQueries(1, 3, "MyQ%", False); Else /* do error processing */ End-if;