--- title: "Count" slug: "count" updated: 2023-09-20T17:47:16Z published: 2023-09-20T17:47:16Z canonical: "docs.datajet.app/count" --- > ## 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. # JoinLayers ## General: JoinLayers #### Join Analysis Functions ## Purpose Use these functions to: - Count the number of layers that matched for each record in a join - Find the first layer that matched for a record - Obtain the binary value of matching layers - Get a match score for each record ## Return Value | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | Low | | **DataType** | Discrete | | **DataSize** | Short / Integer / LongInteger / Double | ```shell Example Return Value: ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1695230457196.png) ## Parameters | Parameter | JSON | Description | | --- | --- | --- | | **Table** | “targetTable”: “foreigntablename” | Required. The foreign table in the join. | | **Filter** | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter recordset will be returned as null. | | **Function** | "function":"joinlayers" | "joinlayers" | | Primary Table | “p1”: “primarytablename” | Required. The primary table in the join. | | Function | “p2”: "function" | Required. One of: - Count - Counts number of layers matched for each record. - First - Returns the first layer matched for each record. - Score - Total score, higher values for earlier (better) matches. - Raw - Binary value of matching layers (1st layer = bit 0) | ## JSON Sample ```json { "method": "BuildBakedField", "targetTable": "DATA_DS1", "overwrite": true, "name": "dj_JL_Count_DS1", "function": "joinlayers", "p1": "customers", "p2": "Count", "project": "SharedLibrary" } ``` ## Usage Notes First build the join, using [AddJoin](/v1/docs/addjoin) and [AddJoinLayer](/v1/docs/addjoinlayer). Then create JoinLayer fields. At least one join layer must be present for JoinLayer functions to be calculated. See Also: - Engineering | [Expression](/v1/docs/expression-field) Field - [Joins](/v1/docs/joins) ## Example | Example | Details | | --- | --- | | **Description** | Count join layers for each record in customer/transaction join | | **Input** | - Table: = "transactions" - Filter: = [No Filter] - **Function: = "joinlayers"** - p1:= "customers" - p2:= "count" - Name: = dj_JL_Count |