Below is the example of using the SetPrxMd operation to create a control in a regular report. The request contains moniker of opened report instance, a pattern indicating whether a control must be created, and metadata that contains parameters of the new control. The operation results in the updated information about all the controls in the regular report.
{
"SetPrxMd" :
{
"tPrx" :
{
"id" : "S1!M!S!P2"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"controls" : "Add"
},
"meta" :
{
"controls" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"autoRecalc" : "true",
"binding" :
{
"value" :
{
"@type" : "q1:UiControlBindingComboBox",
"UI" : "ComboBox",
"value" : "Monday",
"listMode" : "true",
"items" : "Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday",
"separators" : "|"
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"controls" : "Get"
}
}
}
}
{
"SetPrxMdResult" :
{
"id" :
{
"id" : "S1!M!S!P2"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "REPORT_1",
"n" : "Regular report",
"k" : "6334",
"c" : "2562",
"p" : "6333",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"controls" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "ITEM",
"n" : "ITEM",
"vis" : "1",
"value" :
{
"value" : "",
"dt" : "0",
"dimId" :
{
"id" : "S1!M!S!P2!Controls!1"
}
},
"autoRecalc" : "1",
"recalcOnChange" : "0",
"size" :
{
"width" : "-1",
"height" : "-1",
"units" : "DLU96"
},
"dimension" :
{
"dataSource" :
{
"k" : "1",
"id" : "STD_CUBE",
"n" : "Cube",
"vis" : "1"
},
"slice" :
{
"k" : "1",
"id" : "Slice1",
"n" : "Slice1",
"vis" : "1"
},
"dimension" :
{
"k" : "112",
"id" : "CALENDAR",
"n" : "Calendar",
"vis" : "1"
}
},
"appearance" :
{
"report" : "1",
"specificRecalc" : "1",
"recalcAllSheets" : "1"
},
"multiSelect" : "1",
"binding" :
{
"value" :
{
"@type" : "q1:UiControlBindingDimCombo",
"UI" : "DimCombo",
"object" : "CALENDAR",
"valueAttribute" : "ORDER",
"levelAttribute" : "0{}",
"paramValues" : ""
}
},
"changeCounters" :
{
"Content" : "0",
"Structure" : "0"
}
},
{
"k" : "2",
"id" : "ITEM1",
"n" : "ITEM1",
"vis" : "1",
"value" :
{
"value" : "Monday",
"dt" : "1"
},
"autoRecalc" : "1",
"recalcOnChange" : "0",
"size" :
{
"width" : "-1",
"height" : "-1",
"units" : "DLU96"
},
"appearance" :
{
"report" : "1",
"specificRecalc" : "0"
},
"multiSelect" : "2",
"binding" :
{
"value" :
{
"@type" : "q1:UiControlBindingComboBox",
"UI" : "ComboBox",
"value" : "Monday",
"listMode" : "1",
"items" : "Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday",
"separators" : "|"
}
},
"changeCounters" :
{
"Content" : "0",
"Structure" : "0"
}
}
]
},
"sheetControlsOrders" :
{
"its" :
{
"it" :
[
{
"SheetKey" : "1",
"order" :
{
"it" :
[
"1",
"2"
]
}
},
{
"SheetKey" : "2",
"order" :
{
"it" :
[
"1",
"2"
]
}
}
]
}
}
},
"dataChange" :
{
"isDataChanged" : "0"
}
}
}
}
public static SetPrxMdResult CreatePrxControl(PrxId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tArg = new SetPrxMd()
{
tArg = new SetPrxMdArg()
{
meta = new PrxMd()
{
controls = new PrxControls()
{
its = new PrxControl[1]
{
//Parameters of created control
new PrxControl()
{
autoRecalc = true,
//Parameters of control editor
binding = new UiControlBinding()
{
value = new UiControlBindingComboBox()
{
UI = "ComboBox",
items = "Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday",
separators = "|",
value = "Monday",
listMode = true
}
}
}
}
}
},
pattern = new PrxMdPattern()
{
controls = ListOperation.Add
},
metaGet = new PrxMdPattern()
{
controls = ListOperation.Get
}
},
tPrx = moniker
};
//Get metadata
var result = somClient.SetPrxMd(tArg);
return result;
}
See also: