Creating a Control

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 result of the operation is updated information about all the controls in the regular report.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetPrxMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tPrx xmlns="">
  <id>S1!M!S!P2</id>
  </tPrx>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <controls>Add</controls>
  </pattern>
<meta>
<controls>
<its>
<it>
  <k>0</k>
  <autoRecalc>true</autoRecalc>
<binding>
<value xsi:type="q1:UiControlBindingComboBox" xmlns:q1="http://www.fsight.ru/PP.SOM.Som">
  <UI>ComboBox</UI>
  <value>Monday</value>
  <listMode>true</listMode>
  <items>Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday</items>
  <separators>|</separators>
  </value>
  </binding>
  </it>
  </its>
  </controls>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <controls>Get</controls>
  </metaGet>
  </tArg>
  </SetPrxMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetPrxMdResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!P2</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>REPORT_1</i>
  <n>Regular report</n>
  <k>6334</k>
  <c>2562</c>
  <p>6333</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
<controls>
<its>
<it>
  <k>1</k>
  <id>ITEM</id>
  <n>ITEM</n>
  <vis>1</vis>
<value>
  <value />
  <dt>0</dt>
<dimId>
  <id>S1!M!S!P2!Controls!1</id>
  </dimId>
  </value>
  <autoRecalc>1</autoRecalc>
  <recalcOnChange>0</recalcOnChange>
<size>
  <width>-1</width>
  <height>-1</height>
  <units>DLU96</units>
  </size>
<dimension>
<dataSource>
  <k>1</k>
  <id>STD_CUBE</id>
  <n>Cube</n>
  <vis>1</vis>
  </dataSource>
<slice>
  <k>1</k>
  <id>Slice1</id>
  <n>Slice1</n>
  <vis>1</vis>
  </slice>
<dimension>
  <k>112</k>
  <id>CALENDAR</id>
  <n>Calendar</n>
  <vis>1</vis>
  </dimension>
  </dimension>
<appearance>
  <report>1</report>
  <specificRecalc>1</specificRecalc>
  <recalcAllSheets>1</recalcAllSheets>
  </appearance>
  <multiSelect>1</multiSelect>
<binding>
<value xsi:type="q1:UiControlBindingDimCombo">
  <UI>DimCombo</UI>
  <object>CALENDAR</object>
  <valueAttribute>ORDER</valueAttribute>
  <levelAttribute>0{}</levelAttribute>
  <paramValues />
  </value>
  </binding>
<changeCounters>
  <Content>0</Content>
  <Structure>0</Structure>
  </changeCounters>
  </it>
<it>
  <k>2</k>
  <id>ITEM1</id>
  <n>ITEM1</n>
  <vis>1</vis>
<value>
  <value>Monday</value>
  <dt>1</dt>
  </value>
  <autoRecalc>1</autoRecalc>
  <recalcOnChange>0</recalcOnChange>
<size>
  <width>-1</width>
  <height>-1</height>
  <units>DLU96</units>
  </size>
<appearance>
  <report>1</report>
  <specificRecalc>0</specificRecalc>
  </appearance>
  <multiSelect>2</multiSelect>
<binding>
<value xsi:type="q1:UiControlBindingComboBox">
  <UI>ComboBox</UI>
  <value>Monday</value>
  <listMode>1</listMode>
  <items>Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday</items>
  <separators>|</separators>
  </value>
  </binding>
<changeCounters>
  <Content>0</Content>
  <Structure>0</Structure>
  </changeCounters>
  </it>
  </its>
<sheetControlsOrders>
<its>
<it>
  <SheetKey>1</SheetKey>
<order>
  <it>1</it>
  <it>2</it>
  </order>
  </it>
<it>
  <SheetKey>2</SheetKey>
<order>
  <it>1</it>
  <it>2</it>
  </order>
  </it>
  </its>
  </sheetControlsOrders>
  </controls>
<dataChange>
  <isDataChanged>0</isDataChanged>
  </dataChange>
  </meta>
  </SetPrxMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"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"
}
}
}
}

JSON response:

{
"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:

SetPrxMd