Script.GetDataTable(TableName).AddDecimalColumn(Name)

.AddDecimalColumn(Name) adds a column to the data table or grid with the Name provided that will hold Decimal numeric values. Deacom best practice recommends starting the name of these columns with 's_' to differentiate them from Deacom fields, user-defined fields, and calculated fields. This will indicate to users that the column is scripted.

Note: Certain Deacom integers are too big to store as integers in Deacom scripting and must be stored as decimals instead. These are the Sales and Purchase Order numbers.

Applies To

  • Event.Form.MainGrid.Results
  • Event.Form.Parent.MainGrid.Results
  • Event.Form.Parent.GetDataTable([TableName])
  • Event.Form.Parent.Grids(FID).Results
  • Event.Form.GetDataTable([TableName])
  • Event.Form.Grids(FID).Results
  • Inventory.LotExplosion(Lots[, View, EndDate, NegativeLots, ByProducts])
  • Parameters.Results
  • Query.GetTable(Query)
  • Script.GetDataTable(TableName)

Properties and Methods

None

Available

The .AddDecimalColumn(Name) method is available in:

  • 15.03.016
  • All newer builds

Type

Method

Syntax

Script.GetDataTable(TableName).AddDecimalColumn(Name);

Parameters

Parameter

Required

Description

Name

Yes

A unique name used to identify this column.

Deacom recommends starting these columns with 's_' to distinguish them from Deacom, User-defined, and calculated fields.

Example

//--add this script to an event on the NewOrd1 form layout

var loTable = Event.Form.MainGrid.Results;

loTable.AddDecimalColumn('s_Number');

 

/*

Deacom scripting adds a column called 's_Number' to the main grid on a form

When editing the grid layout, this column is now available to show in the grid

You will be able to add new Decimal values to this column as needed

*/