--- title: "CTOD" slug: "ctod" updated: 2023-03-24T13:16:56Z published: 2023-03-24T13:16:56Z canonical: "docs.datajet.app/ctod" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # CTOD ## String: CTOD ## Attempts to create a new discrete field, usually by having applied a filter to a continuous string, integer or double. ## Purpose Use this function to: - Create a discrete field from a continuous field - Create a copy of a continuous field for use as a dimension in a profile - Create a copy of a field for use in a join - Turn a C (continuous) into a D (discrete) Processing TimeCTOD can take a long time to run (i.e., upwards of 1 minute) if the following conditions are met: - Large number of records on the table (> 50 million) - Large number of discrete values (>300,000) CTOD will fail if the number of discrete values in field A exceeds the threshold which is 300,000 by default.     The threshold can be increased by running a BuildBakedField method in script editor and setting MAX_ENTRIES up to 2 million.   However, this can increase processing time significantly, so should only be done where necessary.   ## Return Value | Property | Value | | --- | --- | | **FieldType** | String / Integer / Long(Integer) / Double | | **FieldSize** | Low / Med / High | | **DataType** | Discrete | | **DataSize** | Short / Integer / LongInteger / Double | ```shell Example Return Value: Return values are unchanged from Input value. CTOD is not applicable for Dates or DateTimes. ``` ![CTOD_Sample](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/CTOD_Sample.PNG) ## 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":"" | String | | String Function | “p1”: “CTOD(A)” | CTOD(A) | | A | “p2”: | Required. The discrete field to copy as a continuous field. *Supports:* - **DataType:** Discrete - **Field Type:** Integer, Double, String | | MAX_ENTRIES | | The threshold for crossing from discrete data type to continuous data type. | ## JSON Sample ```json { "method": "BuildBakedField", "targetTable": "BikeTripData", "overwrite": true, "name": "Journey_Random2", "function": "string", "p1": "CTOD(A)", "p2": "Journey_ID", "MAX_ENTRIES": 1000000, "project": "Model1" } ``` ## Usage Notes On very large tables, it may be necessary to use a filter in order to extract a discrete field from a continuous field. In the example below, a random sampe of size 800,000 has been applied to the BikeTripData table in order to create the Journey_Random field. ![CTOD_Example1](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/CTOD_Example1.PNG) Another approach is to use the BuildBakedField method and extend the MAX_ENTRIES threshold. This approach should be used with care, as DataJet's threshold limits are designed to maximize performance across the application. Having a large number of very high cardinality indexed fields (i.e., string fields above 200,000 unique values) may result in a perceptible (i.e., greater than 1 second) response time for operations such as populating the Context Panel grid. <<TODO:   Analyse field function >> ![CTOD_Example2](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/CTOD_Example2.PNG) See Also: - [QQ - How do I use the integrated model processor on very large tables?](https://datajet.document360.io/docs/qq-how-do-i-use-the-integrated-model-processor-on-very-large-tables) - [Getting Started - Data Types](https://datajet.document360.io/docs/getting-started-data-types) - [Expression Field](/v1/docs/expression-field) ## Example | Example | Details | | --- | --- | | **Description** | Convert a continuous string field to a discrete string | | **Input** | - Table: = [BikeTripData] - Filter: = [No Filter] - **Function: = String** - String Function: = CTOD(A) - A:= [BikeTripData].[JourneyID] - Name: = Journey_Random2 | | **Sample** | ![CTOD_Example3](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/CTOD_Example3.PNG) |