阅读:1629回复:0
C++ Example of a NotesQuery Datasetvoid CMapXView::OnNotesQuery() { CMapXDataset ds; CMapXNotesQueryInfo NQI; COleVariant nqiVt, fldsVt; COptionalVariant optVt; CMapXFields flds; try { NQI.CreateDispatch(NQI.GetClsid()); // 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.SetServer(""); NQI.SetDatabase("C:\\Windows\\Desktop\\LotusNotes\\Notesamp.nsf"); NQI.SetQuery("@ALL"); // Or some other appropriate Notes query // for example "@ismember(State;""NY"":""TX"":""CA"":""FL"")" nqiVt.vt = VT_DISPATCH; nqiVt.pdispVal = NQI.m_lpDispatch; nqiVt.pdispVal->AddRef(); // Create a new Fields object, and describe the fields we // are going to import. Using a Fields object is required // for NotesQuery datasets. flds.CreateDispatch(flds.GetClsid()); flds.Add(COleVariant("State"), COleVariant("State"), COleVariant((long)miAggregationIndividual), COleVariant((long)miTypeString)); flds.Add(COleVariant("value"), COleVariant("value"), COleVariant((long)miAggregationSum), COleVariant((long)miTypeNumeric)); fldsVt.vt = VT_DISPATCH; fldsVt.pdispVal = flds.m_lpDispatch; fldsVt.pdispVal->AddRef(); // Create the dataset and add a simple theme ds = m_ctrlMapX.GetDatasets().Add(miDataSetNotesQuery, nqiVt, COleVariant("NotesDS"), COleVariant("State"), optVt, optVt, fldsVt, optVt); ds.GetThemes().Add(miThemeRanged, "value", "NotesThematic"); } catch (COleDispatchException *e) { e->ReportError(); e->Delete(); } catch (COleException *e) { e->ReportError(); e->Delete(); } } |
|
|