Selecting Elements in Specified Calendar Period

Below is the example of using the ChangeDimSelection operation to select elements in the specified calendar period. The request contains moniker of opened calendar dictionary instance, period start and end dates, and element levels must be selected. The response contains summary information about the selected elements.

In the C# example the moniker and period start and end dates are sent as input parameters of the function.

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">
<ChangeDimSelection xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDim xmlns="">
  <id>S1!M!S!S2</id>
  </tDim>
<tArg xmlns="">
  <elSelectOp>Set</elSelectOp>
  <elRelative>Unknown</elRelative>
<setCalendarPeriod>
  <active>true</active>
  <start>2000-01-01</start>
  <end>2000-07-01</end>
<levels>
  <it>Year</it>
  <it>Quarter</it>
  </levels>
  <append>true</append>
  </setCalendarPeriod>
  </tArg>
  </ChangeDimSelection>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ChangeDimSelectionResult 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="">S1!M!S!S2</id>
<selectionInfo xmlns="">
<firstSelected>
  <n>2000</n>
<a>
  <it>1</it>
  <it>2000-01-01</it>
  <it>2000</it>
  <it>YEARS:2000</it>
  <it>1</it>
  <it><A T="A" V="2"><A T="D" V="36526"/><A T="D" V="36891"/></A></it>
  <it>2000</it>
  <it />
  <it />
  <it />
  <it />
  </a>
<ea>
  <it v="1" />
  <it v="2000-01-01" />
  <it v="2000" />
  <it v="YEARS:2000" />
  <it v="1" />
  <it v="" />
  <it v="2000" />
  <it />
  <it />
  <it />
  <it />
  </ea>
  <k>YEARS:2000</k>
  <h>0</h>
  <o>0</o>
  </firstSelected>
<lastSelected>
  <n>III quarter 2000</n>
<a>
  <it>3</it>
  <it>2000-07-01</it>
  <it>III quarter 2000</it>
  <it>QUARTERS:3.2000</it>
  <it>6</it>
  <it><A T="A" V="2"><A T="D" V="36708"/><A T="D" V="36799"/></A></it>
  <it>2000</it>
  <it>2</it>
  <it>3</it>
  <it />
  <it />
  </a>
<ea>
  <it v="3" />
  <it v="2000-07-01" />
  <it v="III quarter 2000" />
  <it v="QUARTERS:3.2000" />
  <it v="6" />
  <it v="" />
  <it v="2000" />
  <it v="2" />
  <it v="3" />
  <it />
  <it />
  </ea>
  <k>QUARTERS:3.2000</k>
  <h>0</h>
  <o>2</o>
  </lastSelected>
  <selectedCount>6</selectedCount>
<calendarPeriod>
  <active>1</active>
  <start>2000-01-01</start>
  <end>2000-07-01</end>
<levels>
  <it>Year</it>
  <it>HalfYear</it>
  <it>Quarter</it>
  </levels>
  </calendarPeriod>
<schema>
  <k>4294967295</k>
  <vis>1</vis>
  <applyOnlyOnce>0</applyOnlyOnce>
  <onceApplied>0</onceApplied>
  <applyOnRebuild>0</applyOnRebuild>
  </schema>
  </selectionInfo>
  </ChangeDimSelectionResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"ChangeDimSelection" :
{
"tDim" :
{
"id" : "S1!M!S!S2"
},
"tArg" :
{
"elSelectOp" : "Set",
"elRelative" : "Unknown",
"setCalendarPeriod" :
{
"active" : "true",
"start" : "2000-01-01",
"end" : "2000-07-01",
"levels" :
{
"it" :
[
"Year",
"Quarter"
]
},
"append" : "true"
}
}
}
}

JSON response:

{
"ChangeDimSelectionResult" :
{
"id" : "S1!M!S!S2",
"selectionInfo" :
{
"firstSelected" :
{
"n" : "2000",
"a" :
{
"it" :
[
"1",
"2000-01-01",
"2000",
"YEARS:2000",
"1",
"<A T="A" V="2"><A T="D" V="36526"\/><A T="D" V="36891"\/><\/A>",
"2000",
"",
"",
"",
""
]
},
"ea" :
{
"it" :
[
{
"@v" : "1"
},
{
"@v" : "2000-01-01"
},
{
"@v" : "2000"
},
{
"@v" : "YEARS:2000"
},
{
"@v" : "1"
},
{
"@v" : "<A T="A" V="2"><A T="D" V="36526"\/><A T="D" V="36891"\/><\/A>"
},
{
"@v" : "2000"
},
"",
"",
"",
""
]
},
"k" : "YEARS:2000",
"h" : "0",
"o" : "0"
},
"lastSelected" :
{
"n" : "III quarter 2000",
"a" :
{
"it" :
[
"3",
"2000-07-01",
"III quarter 2000",
"QUARTERS:3.2000",
"6",
"<A T="A" V="2"><A T="D" V="36708"\/><A T="D" V="36799"\/><\/A>",
"2000",
"2",
"3",
"",
""
]
},
"ea" :
{
"it" :
[
{
"@v" : "3"
},
{
"@v" : "2000-07-01"
},
{
"@v" : "III quarter 2000"
},
{
"@v" : "QUARTERS:3.2000"
},
{
"@v" : "6"
},
{
"@v" : "<A T="A" V="2"><A T="D" V="36708"\/><A T="D" V="36799"\/><\/A>"
},
{
"@v" : "2000"
},
{
"@v" : "2"
},
{
"@v" : "3"
},
"",
""
]
},
"k" : "QUARTERS:3.2000",
"h" : "0",
"o" : "2"
},
"selectedCount" : "6",
"calendarPeriod" :
{
"active" : "1",
"start" : "2000-01-01",
"end" : "2000-07-01",
"levels" :
{
"it" :
[
"Year",
"HalfYear",
"Quarter"
]
}
},
"schema" :
{
"k" : "4294967295",
"vis" : "1",
"applyOnlyOnce" : "0",
"onceApplied" : "0",
"applyOnRebuild" : "0"
}
}
}
}
public static ChangeDimSelectionResult SelectCalendarPeriod(DmId moniker, DateTime StartPeriod, DateTime EndPeriod)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSel = new ChangeDimSelection()
{
tArg = new ChangeDimSelectionArg()
{
//newInstance = true,
elSelectOp = DmElSelectOp.Set,
elRelative = DmElRelative.Unknown,
setCalendarPeriod = new DmCalendarSelectionPeriodArg()
{
active = true,
start = StartPeriod,
end = EndPeriod,
levels = new DimCalendarLvl[2] {DimCalendarLvl.Year, DimCalendarLvl.Quarter},
append = true
},
},
tDim = moniker
};
//Apply alternative hierarchy and select elements
var result = somClient.ChangeDimSelection(tSel);
return result;
}

See also:

ChangeDimSelection