BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
$("#OlapClient").ejOlapClient({ url: "../api/OlapClient", title: "OLAP Browser", displaySettings: { mode: "gridonly" }, customObject: { "cube": "cubeChange" } }); |
static string connectionString = "Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;";
///...
[System.Web.Http.ActionName("InitializeClient")]
[System.Web.Http.HttpPost]
public Dictionary<string, object> InitializeClient(Dictionary<string, object> jsonResult)
{
OlapDataManager DataManager = null;
dynamic customData = serializer.Deserialize<dynamic>(jsonResult["customObject"].ToString());
if (customData is Dictionary<string, object> && customData.ContainsKey("report"))
{
if (customData["cube"] == "cubeChange")
{
connectionString = // modified your connectionString
DataManager = new OlapDataManager(connectionString);
DataManager.SetCurrentReport(CreateOlapReport1()); // specify the OlapReport for the modified cube
}
else
DataManager.SetCurrentReport(CreateOlapReport());
} return olapClientHelper.GetJsonData(jsonResult["action"].ToString(), DataManager, jsonResult["clientParams"].ToString());
}
///..
// specify the OlapReport for the modified cube as below example
private OlapReport CreateOlapReport1()
{
OlapReport olapReport = new OlapReport();
olapReport.Name = "Default Report";
olapReport.CurrentCubeName = "Adventure Works";
DimensionElement dimensionElementColumn = new DimensionElement();
//Specifying the Name for the Dimension Element
dimensionElementColumn.Name = "Customer";
dimensionElementColumn.AddLevel("Customer Geography", "Country");
MeasureElements measureElementColumn = new MeasureElements();
//Specifying the Name for the Measure Element
measureElementColumn.Elements.Add(new MeasureElement { Name = "Customer Count" });
DimensionElement dimensionElementRow = new DimensionElement();
//Specifying the Dimension Name
dimensionElementRow.Name = "Date";
dimensionElementRow.AddLevel("Fiscal", "Fiscal Year");
///Adding Row Members
olapReport.SeriesElements.Add(dimensionElementColumn);
///Adding Column Members
olapReport.CategoricalElements.Add(dimensionElementRow);
///Adding Measure Element
olapReport.CategoricalElements.Add(measureElementColumn);
return olapReport;
} |
@Html.EJ().Olap().OlapClient("PivotClient1").Url(Url.Content("~/api/OlapClient")).Title("OLAP Browser").CustomObject(@ViewBag.test) |
public ActionResult Index()
{
Dictionary<string, object> test = null;//Dictionary datatype
test = new Dictionary<string, object>();
test.Add("cube", "Channel Sales");
ViewBag.test = test;
return View();
} |