logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Writing back data from a view using XML (C#)
CarpeDatum
#1 Posted : Wednesday, March 30, 2011 7:49:05 AM(UTC)
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);
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.047 seconds.