<?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 Re: tabular editor Loop through Calculated Columns in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/tabular-editor-Loop-through-Calculated-Columns/m-p/4017397#M53799</link>
    <description>&lt;P&gt;The documentation seems to indicate that the type exists.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.tabulareditor.com/api/TabularEditor.TOMWrapper.ColumnType.html" target="_blank"&gt;Enum ColumnType | Tabular Editor Documentation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does "doesn't work"&amp;nbsp; mean?&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 00:56:07 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-07-01T00:56:07Z</dc:date>
    <item>
      <title>tabular editor Loop through Calculated Columns</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/tabular-editor-Loop-through-Calculated-Columns/m-p/4015776#M53782</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;im writing a C# script in Tabular Editor to loop through the model and change the naming convention of measures and calculated columns (inherited several reports from business and its a bit messy) the Measure part works perfectly - code adds "Msr" abbreviation to each measure and moves it to Calculations. The problem appears with calculated columns - seems like the check of columnType.Calculated doesnt work. Does anyone know how to check the columntype properly?&lt;/P&gt;&lt;P&gt;Thank you:)&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;var calcTable = Model.Tables.FirstOrDefault(t =&amp;gt; t.Name == "Calculations");

Func&amp;lt;string, string, string&amp;gt; FormatName = (name, prefix) =&amp;gt; {
    string formattedName = name.Replace(" ", "_");
    if (!formattedName.StartsWith(prefix)) {
        formattedName = prefix + formattedName;
    }
    return formattedName;
};

foreach (var table in Model.Tables) {
    foreach (var measure in table.Measures.ToList()) {
        measure.Name = FormatName(measure.Name, "Msr");
        measure.MoveTo(calcTable);
    }
foreach (var column in table.Columns.ToList()) {
     if (column.ColumnType== ColumnType.Calculated) {
          if (!column.Name.StartsWith("CC")) {
              column.Name = FormatName(column.Name, "CC");
            }
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 14:00:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/tabular-editor-Loop-through-Calculated-Columns/m-p/4015776#M53782</guid>
      <dc:creator>MattReckoner111</dc:creator>
      <dc:date>2024-06-28T14:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: tabular editor Loop through Calculated Columns</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/tabular-editor-Loop-through-Calculated-Columns/m-p/4017397#M53799</link>
      <description>&lt;P&gt;The documentation seems to indicate that the type exists.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.tabulareditor.com/api/TabularEditor.TOMWrapper.ColumnType.html" target="_blank"&gt;Enum ColumnType | Tabular Editor Documentation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does "doesn't work"&amp;nbsp; mean?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 00:56:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/tabular-editor-Loop-through-Calculated-Columns/m-p/4017397#M53799</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-07-01T00:56:07Z</dc:date>
    </item>
  </channel>
</rss>

