阅读:1438回复:0
Delphi Example of a NotesQuery Dataset
procedure TMapForm.NotesQueryButtonClick(Sender: TObject);
var NQI: Variant; ds: Dataset; flds: CMapXFields; begin try { Create a new NotesQueryInfo object; CreateOleObject is found in the 'ComObj' package } NQI := CreateOleObject('MapX.NotesQueryInfo.4'); { Change this to point to the appropriate server and database; a sample database is included on the MapX CD. Leave the Server field empty if accessing a local database } NQI.Server := ''; NQI.Database := 'C:\Windows\Desktop\LotusNotes\Notesamp.nsf'; NQI.Query := '@All'; { Or some other appropriate Notes query for example '@ismember(State;"NY":"TX":"CA":"FL")' } { Create a new Fields object and use it to describe the fields we are going to import. Using a Fields object is required for NotesQuery datasets. } flds := CoFields.Create; flds.Add('State', 'State', miAggregationIndividual, miTypeString); flds.Add('Value', 'Value', miAggregationSum, miTypeNumeric); ds := Map1.Datasets.Add(miDataSetNotesQuery, NQI, 'NotesDS', 'State', EmptyParam, EmptyParam, flds, EmptyParam); ds.Themes.Add(miThemeRanged, 'Value', 'NotesThematic', EmptyParam); except on E: EOleException do Application.MessageBox(PChar(E.Message), 'Error', MB_OK or MB_ICONERROR); end; end; |
|
|