We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Pass parameter for know which cube load

Thread ID:





126403 Oct 13,2016 08:13 PM UTC Oct 21,2016 06:28 AM UTC ASP.NET MVC 5
Tags: PivotClient
Felipe Alves
Asked On October 13, 2016 08:13 PM UTC

Hi, i want pass parameter (string) for know which cube i have to load, 

i was thinking something like:

 @Html.EJ().Olap().OlapClient("OlapClient1").Url("").Title("Titulos a Pagar").Parameter(stringParameter)

or if have another way for do this, i'll appreciate that


Sastha Prathap Selvamoorthy [Syncfusion]
Replied On October 14, 2016 12:53 PM UTC

Hi Felipe, 
You can change the connection string by passing string to an object through the parameter “customObject” to initialize the control. Please find the following sample code snippet that can achieve your requirement. 
Here is the code snippet for sending the “customObject” in sample. 
$("#OlapClient").ejOlapClient({ url: "../api/OlapClient", title: "OLAP Browser", displaySettings: { mode: "gridonly" }, customObject: { "cube": "cubeChange" } }); 
Here is the code snippet for modified the connectionString using “customObject” in WebAPI controller (Server Side). 
static string connectionString = "Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;"; 
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 
            }       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 
    ///Adding Column Members 
    ///Adding Measure Element 
    return olapReport; 
Sastha Prathap S. 

Felipe Alves
Replied On October 20, 2016 11:53 AM UTC

Hi Sastha,

Can you show me how i do this?

$("#OlapClient").ejOlapClient({ url: "../api/OlapClient", title: "OLAP Browser", displaySettings: { mode: "gridonly" }, customObject: { "cube""cubeChange" } }); 

I understand "Olapclient" it's id from some component, but i want know which is...

If you can show me all code from this part i can finish!


Felipe Alves
Replied On October 20, 2016 01:21 PM UTC

I created at my controller something like

  Dictionary<string, Object > try= new Dictionary<string, Object>();

            var s = new {cubeName= "cube", cubeCatalog= "catalog" };
            ewqe.Add("c", s);
            ViewBag.teste = try

But when go to api this viewbag.teste values its empty, just have parameter, but value key its empty

Felipe Alves
Replied On October 20, 2016 04:32 PM UTC

i did here,


Sastha Prathap Selvamoorthy [Syncfusion]
Replied On October 21, 2016 06:28 AM UTC

Hi Felipe, 
We have prepared a sample where you can change the cube by passing the Cube name through “CustomObject” to server side from sample level itself. Please find the sample code snippet and sample link below for your reference. 
Sample Code for passing the CustomObject from sample. 
    @Html.EJ().Olap().OlapClient("PivotClient1").Url(Url.Content("~/api/OlapClient")).Title("OLAP Browser").CustomObject(@ViewBag.test) 
Sample Code for passing the CustomObject from controller to Viewpage. 
        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(); 
Sastha Prathap S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon