ComponentOne Query 8.0
Modifying Schema and Field List at Run Time

A C1Query control stores a schema that is used to present folder fields to the user in the associated C1QueryFrame controls. There are also provisions in the C1Query control allowing you to modify the end user view of the schema dynamically.

Calling the LoadSchemaFromFile method, the schema can be replaced at run time with the schema stored in a file. The schema can be created at design time in schema designer, and saved in a file, or it can be created at run time.

Alternatively, you can also assign the string representing a schema to the Schema property. The schema string is simply the contents of a text file containing a schema. To obtain it, you can save a schema to a file in schema designer, or you can create a schema programmatically at run time.

If you need to create a schema at run time, you can use XML DOM. A schema is an XML document with fixed structure, so it can be created at run time programmatically using Microsoft XML parser, the MSXML.IXMLDOMElement interface. The structure of schema XML is defined in the HTML file c1query_schema_format.htm. For an example of programmatic schema creation, see RunTimeSchemaInit sample in the Samples\VB directory.

You can also hide/show specific fields and/or entire folders from the end user, calling the ShowFolderFields method.

Another option is to create a schema with multiple independent set of views. It is possible that a schema consists of multiple sets of views so that these sets are unrelated to each other. It means that a user query cannot span different unrelated sets of views, the user is enabled only to choose fields from a single, fixed set of views. In this situation, the schema designer will show a warning in schema verification (Verify schema in the Schema menu), but such schemas can still be valid and useful.

A set of interrelated views independent of other sets of views is identified by its main view name. All other views from the same set are related (with relationships and/or join groups) to the set’s main view. Every set of interrelated views has one and only one main view.

For a multi-viewset schema, you can set the MainViewName property of the C1Query control to determine the currently active set of views. Only fields belonging to the active set will be shown to the end user in the associated C1QueryFrame controls. The MainViewCount property returns the number of sets. MainViewNames(Index) returns the main view name of the set number Index.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback