<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Table Column Sum in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627274#M10600</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a table. and it has data-numbers on it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I sum the 4th column in this table from the 1st row?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the result with message box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; var table = new Table();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Dec 2022 21:26:24 GMT</pubDate>
    <dc:creator>k005</dc:creator>
    <dc:date>2022-12-17T21:26:24Z</dc:date>
    <item>
      <title>Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627274#M10600</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a table. and it has data-numbers on it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I sum the 4th column in this table from the 1st row?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the result with message box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; var table = new Table();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 21:26:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627274#M10600</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2022-12-17T21:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627350#M10601</link>
      <description>&lt;P&gt;Something like this, modify as needed.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;

using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
    Table acTable;
    acTable = acTrans.GetObject(acCurDb.CurrentSpaceId, OpenMode.ForRead) as Table;
double sum = 0;

for (int i = 0; i &amp;lt; acTable.Rows.Count; i++)
{
    for (int j = 0; j &amp;lt; acTable.Columns.Count; j++)
    {
        Cell acCell = acTable.Cells[i, j];
        sum += (double)acCell.GetValue(acTrans);
    }
}
}&lt;/LI-CODE&gt;&lt;P&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 23:15:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627350#M10601</guid>
      <dc:creator>JTBWorld</dc:creator>
      <dc:date>2022-12-17T23:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627653#M10602</link>
      <description>&lt;P&gt;Thanks for the answer. This is how my table is created. At the end of the code, I determine the table position by choosing a point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* I tried to add the codes you sent, but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;       foreach (var entry in blocks)
                {
                    table.Cells[row, 0].BlockTableRecordId = entry.Value[0].BlockTableRecord;

                    string searched = "Q";//
                    bool bak = (bool)(table.Cells[row, 1].Value = entry.Key.Contains(searched));

                    table.Cells[row, 1].Value = entry.Key;          // İSİM
                    table.Cells[row, 2].Value = entry.Value.Length; // ADET

                    if (bak == true)
                    {
                        table.Cells[row, 3].Value = "-";
                        table.Cells[row, 4].Value = "-";
                        table.Cells[row, 5].Value = "-";
                    }
                    else
                    {
                        table.Cells[row, 3].Value = (entry.Value.Length * double.Parse(entry.Key.Split('-')[1])).ToString("F2"); //adet * boy
                        table.Cells[row, 4].Value = (double.Parse((trg.Krs(int.Parse(entry.Key.Split('-')[0].Remove(0, 1))) * 0.00617).ToString("F3")) * entry.Value.Length * double.Parse(entry.Key.Split('-')[1])).ToString("F2");  //Ağırlık.
                        table.Cells[row, 5].Value = (entry.Value.Length * double.Parse(entry.Key.Split('-')[1]) / 12).ToString("F2"); //adet * boy / 12m Çubuk

                    }
                    row++;
                }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sum += (double)acCell.GetValue(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;acTrans&lt;/STRONG&gt;&lt;/FONT&gt;);&amp;nbsp;&amp;nbsp; ---&amp;gt; red part error...&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 08:17:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11627653#M10602</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2022-12-18T08:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11628097#M10603</link>
      <description>&lt;P&gt;Well, if your OWN CODE fills up the table's columns/cells, wouldn't you (or the code) already know the sum of each column after the cells being filled in your "foreach..." loop?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 14:45:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11628097#M10603</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-12-18T14:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11628116#M10604</link>
      <description>&lt;P&gt;Yes. After picking a point and creating the table, I can explode it and get a total.&lt;/P&gt;&lt;P&gt;but what I want to do is to get a total without detonating.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 15:09:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11628116#M10604</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2022-12-18T15:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11629675#M10605</link>
      <description>&lt;P&gt;Again, SINCE YOUR CODE FILLS(!!!) the table cells, you should have already known the sum of each column after the table cells are filled in the "foreach (var entry...){...}" loop. So, there is no need to try to figure out the sums AFTER the table is created, or even go to the extreme to explode it for that matter. As matter of fact, you do not even need to create the table for get the column sums of a set of tabular data (which you retrieved from a set of blocks).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var colSum1=0.0;&lt;/P&gt;
&lt;P&gt;var colSum2=0.0;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;foreach (var entry in blocks)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var num1=entry.prop1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;// fill out the cell of first row, first column, if you whish;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;colSum+=num1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var num2=entry.prop2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;// fill out the cell of first row, second column, if you whish;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;colSum2+=num2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ... ...&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;editor.WriteMessage($"\nSUM of Column1={colSum1}\tSUM of Column2={colSum2}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 14:12:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11629675#M10605</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-12-19T14:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11629798#M10606</link>
      <description>&lt;P&gt;You need a table. because block shapes are also required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;var num1=entry.&lt;STRONG&gt;prop1&amp;nbsp; ---&amp;gt; &lt;/STRONG&gt;What is the full definition of this?&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 15:07:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11629798#M10606</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2022-12-19T15:07:39Z</dc:date>
    </item>
    <item>
      <title>Ynt: Table Column Sum</title>
      <link>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11631178#M10607</link>
      <description>&lt;P&gt;Isn't there another way to sum column 4?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;table.Cells[row, 4].Value = (double.Parse((trg.Krs(int.Parse(entry.Key.Split('-')[0].Remove(0, 1))) * 0.00617).ToString("F3")) * entry.Value.Length * double.Parse(entry.Key.Split('-')[1])).ToString("F2");  //Ağırlık.
                       &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 07:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/table-column-sum/m-p/11631178#M10607</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2022-12-20T07:41:30Z</dc:date>
    </item>
  </channel>
</rss>

