- 1 Minute to read
- Print
- DarkLight
- PDF
FirstDiscrete
- 1 Minute to read
- Print
- DarkLight
- PDF
General: FirstDiscrete
Creates a flag field where the first occurrence of each unique value in the specified field is set to 1.
Purpose
- Gain a count of how many discrete values of a field there are in RecordSet
- Identify one and only one occurrence of a particular field value within a table
Return Value
Property | Value |
---|---|
FieldType | Integer |
FieldSize | Low |
DataType | Discrete |
DataSize | Byte |
Example Return Value: 0 , 1, null
Parameters
Parameter | JSON | Description |
---|---|---|
Table | “targetTable”: “MyTableName” | The target table on which the new field will be created |
Filter | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter recordset will be returned as null. |
Function | "function":"firstdiscrete" | FirstDiscrete |
Distinct Field | “p1”: “DistinctFieldName” | Required. Field on the target table to use when flagging first occurrence of a record. All Field Types are always valid as Distinct Fields. Continuous fields are usually valid, but because the FirstDiscrete operation is memory intensive, depending on the Table Size and DataType, it may not be possible to complete the operation. Integer fields are always valid. LongInteger fields are valid if Max - Min < 4 billion. Continuous String fields depend on:
Continuous String fields will be slower than Integer or LongInteger fields. To increase the ability of the system to perform FirstDiscrete operations, add more memory to the system. In general, ability increases with RAM. Performance increases with the number of cores (as long as the system is using a Solid State disk, otherwise increasing the number of cores could degrade performance). |
JSON Sample
{
"method": "BuildBakedField",
"project": "D3",
"targetTable": "transactions",
"overwrite": true,
"name": "FD_cid",
"function": "firstdiscrete",
"p1": "cid"
}
Usage Notes
See Also:
- Engineering | Expression Field
- DistinctByKey (General Functions)
- FirstDiscreteByIndex (General Functions)
Example
Example | Details |
---|---|
Description | Flag first distinct occurrence of CID |
Input |
|
Sample |