Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/1097 in the doc md files for dataExtensions decimal field type has only precision not scale #1098

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,11 @@ class DataExtension extends MetadataType {
for (const element of fieldsJson) {
const newJsonElement = {};
for (const field of fieldsToKeep) {
newJsonElement[field] = element[field];
if (field === 'MaxLength' && element.FieldType === 'Decimal') {
newJsonElement.MaxLength = `${element.MaxLength},${element.Scale}`;
} else {
newJsonElement[field] = element[field];
}
}
newJson.push(newJsonElement);
}
Expand Down
16 changes: 16 additions & 0 deletions test/resources/9999999/dataExtension/build-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
"IsRequired": true,
"IsPrimaryKey": true,
"FieldType": "Text"
},
{
"Name": "decimalField",
"DefaultValue": "",
"MaxLength": 6,
"Scale": 3,
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Decimal"
},
{
"Name": "numberField",
"DefaultValue": "",
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Number"
}
],
"r__folder_ContentType": "dataextension",
Expand Down
16 changes: 16 additions & 0 deletions test/resources/9999999/dataExtension/retrieve-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
"IsRequired": true,
"IsPrimaryKey": true,
"FieldType": "Text"
},
{
"Name": "decimalField",
"DefaultValue": "",
"MaxLength": 6,
"Scale": 3,
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Decimal"
},
{
"Name": "numberField",
"DefaultValue": "",
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Number"
}
],
"r__folder_ContentType": "dataextension",
Expand Down
4 changes: 3 additions & 1 deletion test/resources/9999999/dataExtension/retrieve-expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Folder:** Data Extensions/

**Fields in table:** 4
**Fields in table:** 6

**Sendable:** Yes (`ContactKey` to `Subscriber Key`)

Expand All @@ -16,3 +16,5 @@
| LastName | Text | 50 | - | + | |
| EmailAddress | EmailAddress | 254 | - | - | |
| ContactKey | Text | 50 | + | - | |
| decimalField | Decimal | 6,3 | - | - | |
| numberField | Number | | - | - | |
16 changes: 16 additions & 0 deletions test/resources/9999999/dataExtension/template-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
"IsRequired": true,
"IsPrimaryKey": true,
"FieldType": "Text"
},
{
"Name": "decimalField",
"DefaultValue": "",
"MaxLength": 6,
"Scale": 3,
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Decimal"
},
{
"Name": "numberField",
"DefaultValue": "",
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Number"
}
],
"r__folder_ContentType": "dataextension",
Expand Down
16 changes: 16 additions & 0 deletions test/resources/9999999/dataExtension/update-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@
"IsPrimaryKey": true,
"FieldType": "Text"
},
{
"Name": "decimalField",
"DefaultValue": "",
"MaxLength": 6,
"Scale": 3,
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Decimal"
},
{
"Name": "numberField",
"DefaultValue": "",
"IsPrimaryKey": false,
"IsRequired": true,
"FieldType": "Number"
},
{
"Name": "testField",
"DefaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,41 @@
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
<Results xsi:type="DataExtensionField">
<PartnerKey xsi:nil="true" />
<ObjectID>7b7ef009-4b85-455b-9bdf-b7bef93791d7</ObjectID>
<CustomerKey>[testExisting_dataExtension].[numberField]</CustomerKey>
<Name>numberField</Name>
<Scale>0</Scale>
<DefaultValue />
<IsRequired>true</IsRequired>
<Ordinal>5</Ordinal>
<IsPrimaryKey>false</IsPrimaryKey>
<FieldType>Number</FieldType>
<DataExtension>
<PartnerKey xsi:nil="true" />
<ObjectID xsi:nil="true" />
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
<Results xsi:type="DataExtensionField">
<PartnerKey xsi:nil="true" />
<ObjectID>c5d553cc-2c2a-464d-953d-6901be040f20</ObjectID>
<CustomerKey>[testExisting_dataExtension].[decimalField]</CustomerKey>
<Name>decimalField</Name>
<Scale>3</Scale>
<DefaultValue />
<MaxLength>6</MaxLength>
<IsRequired>true</IsRequired>
<Ordinal>4</Ordinal>
<IsPrimaryKey>false</IsPrimaryKey>
<FieldType>Decimal</FieldType>
<DataExtension>
<PartnerKey xsi:nil="true" />
<ObjectID xsi:nil="true" />
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
</RetrieveResponseMsg>
</soap:Body>
</soap:Envelope>
</soap:Envelope>
37 changes: 36 additions & 1 deletion test/resources/9999999/dataExtensionField/retrieve-response.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,41 @@
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
<Results xsi:type="DataExtensionField">
<PartnerKey xsi:nil="true" />
<ObjectID>7b7ef009-4b85-455b-9bdf-b7bef93791d7</ObjectID>
<CustomerKey>[testExisting_dataExtension].[numberField]</CustomerKey>
<Name>numberField</Name>
<Scale>0</Scale>
<DefaultValue />
<IsRequired>true</IsRequired>
<Ordinal>5</Ordinal>
<IsPrimaryKey>false</IsPrimaryKey>
<FieldType>Number</FieldType>
<DataExtension>
<PartnerKey xsi:nil="true" />
<ObjectID xsi:nil="true" />
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
<Results xsi:type="DataExtensionField">
<PartnerKey xsi:nil="true" />
<ObjectID>c5d553cc-2c2a-464d-953d-6901be040f20</ObjectID>
<CustomerKey>[testExisting_dataExtension].[decimalField]</CustomerKey>
<Name>decimalField</Name>
<Scale>3</Scale>
<DefaultValue />
<MaxLength>6</MaxLength>
<IsRequired>true</IsRequired>
<Ordinal>4</Ordinal>
<IsPrimaryKey>false</IsPrimaryKey>
<FieldType>Decimal</FieldType>
<DataExtension>
<PartnerKey xsi:nil="true" />
<ObjectID xsi:nil="true" />
<CustomerKey>testExisting_dataExtension</CustomerKey>
</DataExtension>
</Results>
</RetrieveResponseMsg>
</soap:Body>
</soap:Envelope>
</soap:Envelope>
Loading