Step 5 Your Application

Integrate into your application

Now that the dGraph is defined and built, you can add it to your application. The steps are really simple. First register with the CeleriQ engine. Then query the engine for data. Finally use the data.

//Register with the CeleriQ engine
AutoItemUrlQuery.dGraphRegister("server=…;database=…;uid=…;pwd=…");

//Setup a query object and item collection object
AutoItemUrlQuery query = new AutoItemUrlQuery();
query.ExposeAllDimensionListRefinements = true;
query.ExposeAllCompleteDimensionListRefinements = true;
AutoItemCollection autoItemCollection = new AutoItemCollection(query);
autoItemCollection.Execute();

//Bind the collection to a datalist
grdList.DataSource = autoItemCollection;
grdList.DataBind();

//In the ItemDataBound event set the inner controls
protected void OnItemDataBound(object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) ||
(e.Item.ItemType == ListItemType.AlternatingItem))
{
AutoItem item = (AutoItem)e.Item.DataItem;
Label lblTitle = (Label)e.Item.FindControl("lblTitle");
lblTitle.Text = item.Title; }
}

Of course this code only shows the first 10 records by default. You will need to build some sort of functionality to allow the users to choose a page and perhaps records per page count. You can expand this functionality as far as desired with "go to" links and other advanced functionality. The code above does show how to make a real application work with the strongly-typed, generated API calling the CeleriQ engine.

page_revision: 4, last_edited: 1206320813|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License