Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge b10a096 into 0ac9cb8
Browse files Browse the repository at this point in the history
  • Loading branch information
timwellswa committed May 25, 2021
2 parents 0ac9cb8 + b10a096 commit 1c7b6f9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.126.0] - 2021-05-24
### Added
- add support for column formulas

## [2.101.0] - 2020-07-28
### Fixed
- [image.id versus image.imageId #119](https://github.com/smartsheet-platform/smartsheet-csharp-sdk/issues/119)
Expand Down
23 changes: 22 additions & 1 deletion IntegrationTestSDK/ColumnResourcesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public void TestColumnResources()
UpdateColumn(smartsheet, sheetId, columnId);
DeleteAndGetColumn(smartsheet, sheetId, columnId);

columnId = AddColumnFormula(smartsheet, sheetId);
ClearColumnFormula(smartsheet, sheetId, columnId);

smartsheet.SheetResources.DeleteSheet(sheetId);
}

Expand All @@ -34,7 +37,7 @@ private static void DeleteAndGetColumn(SmartsheetClient smartsheet, long sheetId
}
catch
{
//Not found.
// Not found.
}
}

Expand All @@ -59,6 +62,24 @@ private static void AddColumns(SmartsheetClient smartsheet, long sheetId)
Assert.IsTrue(columnsAdded[0].Title == "col 4");
}

private static long AddColumnFormula(SmartsheetClient smartsheet, long sheetId)
{
Column col = new Column.AddColumnBuilder("colFormula", 3, ColumnType.DATE).Build();
col.Formula = " = TODAY()";
IList<Column> columnsAdded = smartsheet.SheetResources.ColumnResources.AddColumns(sheetId, new Column[] { col });
Assert.IsTrue(columnsAdded.Count == 1);
Assert.IsNotNull(columnsAdded[0].Formula);
return columnsAdded[0].Id.Value;
}

private static void ClearColumnFormula(SmartsheetClient smartsheet, long sheetId, long columnId)
{
Column col = new Column.UpdateColumnBuilder(columnId, "colFormula updated", 2).Build();
col.Formula = "";
Column updatedColumn = smartsheet.SheetResources.ColumnResources.UpdateColumn(sheetId, col);
Assert.IsNull(updatedColumn.Formula);
}

private static long CreateSheet(SmartsheetClient smartsheet)
{
Column[] columnsToCreate = new Column[] {
Expand Down
1 change: 0 additions & 1 deletion Smartsheet-csharp-sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@
<Compile Include="main\Smartsheet\Api\Models\Webhook.cs" />
<Compile Include="main\Smartsheet\Api\Models\WebhookStats.cs" />
<Compile Include="main\Smartsheet\Api\Models\Widget.cs" />
<Compile Include="main\Smartsheet\Api\Models\WidgetContent.cs" />
<Compile Include="main\Smartsheet\Api\Models\WidgetType.cs" />
<Compile Include="main\Smartsheet\Api\PassthroughResources.cs" />
<Compile Include="main\Smartsheet\Api\SheetAutomationRuleResources.cs" />
Expand Down
6 changes: 3 additions & 3 deletions documentation/smartsheet-csharp-sdk-docs-v2.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<PresentationStyle>VS2013</PresentationStyle>
<Preliminary>False</Preliminary>
<NamingMethod>Guid</NamingMethod>
<HelpTitle>Smartsheet C# SDK Documentation v2.101.0</HelpTitle>
<HelpTitle>Smartsheet C# SDK Documentation v2.126.0</HelpTitle>
<FeedbackEMailAddress>api%40smartsheet.com</FeedbackEMailAddress>
<CopyrightText>%28c%29 2014-2020. All Rights Reserved</CopyrightText>
<CopyrightText>%28c%29 2014-2021. All Rights Reserved</CopyrightText>
<CopyrightHref>Smartsheet</CopyrightHref>
<ContentPlacement>BelowNamespaces</ContentPlacement>
<DocumentationSources>
Expand Down Expand Up @@ -88,7 +88,7 @@
<Argument Key="maxVersionParts" Value="" />
<Argument Key="defaultLanguage" Value="cs" />
</TransformComponentArguments>
<HelpFileVersion>2.101.0.0</HelpFileVersion>
<HelpFileVersion>2.126.0.0</HelpFileVersion>
<RootNamespaceTitle>Smartsheet C# SDK Help Topics</RootNamespaceTitle>
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
</PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions main/Smartsheet/Api/Models/Column.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public class Column : IdentifiableModel
/// </summary>
private string format;

/// <summary>
/// The formula for a column, if set, for instance '=data@row'.
/// </summary>
private string formula;

/// <summary>
/// Represents the hidden flag for the column.
/// </summary>
Expand Down Expand Up @@ -182,6 +187,16 @@ public string Format
set { format = value; }
}

/// <summary>
/// <para>The formula for a column.</para>
/// </summary>
/// <returns>the column formula</returns>
public string Formula
{
get { return formula; }
set { formula = value; }
}

/// <summary>
/// Gets the hidden flag.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion smartsheet-csharp-sdk-v2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Authors>Smartsheet</Authors>
<Product>smartsheet-csharp-sdk</Product>
<PackageTags>Smartsheet Collaboration Project Management Excel spreadsheet</PackageTags>
<Version>2.101.0</Version>
<Version>2.126.0</Version>
<AssemblyName>smartsheet-csharp-sdk</AssemblyName>
<RootNamespace>smartsheet-csharp-sdk</RootNamespace>
</PropertyGroup>
Expand Down

0 comments on commit 1c7b6f9

Please sign in to comment.