This example shows how to build a Data Model using the Table Catalog object. It assumes that you are already connected to a database:
with (ActiveDocument.Sections["Query"].DataModel) { Topics.RemoveAll() AutoJoin = false //Create two new topics from tables in Table Catalog Catalog.Refresh() Table1 =Catalog.CatalogItems["WINE"] Table2 =Catalog.CatalogItems["WINE_SALES"] Topics.Add(Table1) Topics.Add(Table2) Field1 = Topics[1].TopicItems["Wine Id"] Field2 = Topics[2].TopicItems["Wine Id"] //Create a new join by joining two TopicItems together Joins.Add(Field1,Field2,bqJoinSimpleEqual) // Now add topic items to the request line for (I = 1; I <= Topics[1].TopicItems.Count; I++) ActiveDocument.Sections["Query"].Requests.Add( Topics[1].Name, Topics[1].TopicItems[I].DisplayName) }
This example shows how to connect to an existing connection, remove all the limits, and process a query:
MyQuery = ActiveDocument.Sections["Query"] MyQuery.DataModel.Connection.Username = "hyperion" MyQuery.DataModel.Connection.SetPassword("hyperion") MyQuery.DataModel.Connection.Connect() MyQuery.Limits.RemoveAll() MyQuery.Process() RowReturned = ActiveDocument.Sections["Results"].RowReturned Console.Writeln("Returned "+ RowReturned+" Rows!")
Activate(), Copy(), CustomSQLFrom(CustomSQLStr as String), CustomSQLWhere(CustomSQLStr as String), Duplicate(), Export([optional] Filename as String, [optional] FileFormat as BqExportFileFormat, [optional] IncludeHeaders as Boolean, [optional] Prompt as Boolean}, ExportToStream([optional] String Filename, [optional] FileFormat as BqExportFileFormat, [optional] IncludeHeaders as Boolean, [optional] DataStreaming as Boolean, Prompt as Boolean, [optional] Enclding as BqEncoding, ImportSQLFile(Filename as String, numColumns as Number), PrintOut([optional] From Page as Number, [optional] ToPage as Number, [optional]Copies as Number, [optional] Filename as String, [optional] Prompt as Boolean), Process(), ProcessStoredProc(), ProcessToTable(Tablename as String, ProcessType as BqProcessType, [optional] Grantee as String), Recalculate,() Remove(), ResetCustomSQL(), SetStoredProcParam(Parameter as Value, [optional] ParamIndex as Number)
Read-only: Property Active As Boolean, Property LastPrinted as Date, Property LastSQLStatement as String, Property QuerySize as Number, Property Sorts As Sorts, Property Type As BqSectionType
Read-write: Property AutoProcess As Boolean, Property IncludeInProcessAll as Boolean, Property Name As String, PropertySequenceNum as Number, Property RowLimit as Number, Property RowLimitActive as Boolean, Property SaveResults As Boolean, Property ShowOutliner as Boolean, Property ShowSortLine as Boolean, Property TimeLimit As Number, Property TimeLimitActive as Boolean, Property UniqueRows As Boolean, Property Visible As Boolean
UserValue as UserValues, Limits As Limits, AggregateLimits As AggregateLimits, Items, Requests As Requests, SortItems as SortItems, AppendQueries As AppendQueries