Rank: Administration
Groups: Registered, Administrators Joined: 8/17/2010(UTC) Posts: 6 Location: Denver
|
The following code is a sample of querying the data from a TM1 cube called Financials, changing some cell values, and then writing back the data to TM1 using XML. Code:
ES.ESWebService ws = new ES.ESWebService();
ES.ESErrorInfo err = null;
XmlNode col = null;
// Get the data from a TM1 View called Sales Entry in cube Financials
XmlNode response = ws.TM1View("Financials", "SalesEntry", true, out err);
if (err.Success == false)
return;
// Locate the rowset node
XmlNode rowset = response.SelectSingleNode("RowSet");
// Loop through all the rows
foreach (XmlNode row in rowset.ChildNodes)
{
// Get the October node and decrease it by 3%
col = row.SelectSingleNode("Oct");
if (col != null)
col.InnerText = Convert.ToString((Convert.ToDouble(col.InnerText) * .97));
// Now take December and increase it by 5%
col = row.SelectSingleNode("Dec");
if (col != null)
col.InnerText = Convert.ToString((Convert.ToDouble(col.InnerText) * 1.05));
}
// Now write the updates back to TM1
ws.TM1ViewWrite( response.OuterXml, out err);
|