Change data types by C# script #1163
Answered
by
otykier
rvgfox
asked this question in
🙋♀️TE3 Q&A
-
I'm creating the models in an Azure Analysis Server using an "automatic" tool. This tool create all the numeric colums using the Double data type.
Two questions:
Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
otykier
Nov 2, 2023
Replies: 1 comment 1 reply
-
// Loop through all columns of the model:
foreach (var c in Model.AllColumns)
{
// If a column is currently set to double...
if (c.DataType == DataType.Double)
{
// ...hide the column:
c.IsHidden = true;
// ...change date type to decimal:
c.DataType = DataType.Decimal;
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
otykier
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
foreach(var c in Model.AllColumns)
. However, you should probably add a check to make sure you're only changing columns that are currently set to Double: