przejście do zawartości
SDS Manual
Ta strona jest tylko do odczytu. Możesz wyświetlić źródła tej strony ale nie możesz ich zmienić.
# Data Source This document describes how to create and configure data sources in the application. ## Field Types Data sources support two main field types: ### Variable Variables represent single values extracted from the data source. ```json { "type": "variable", "selector": "$.val1", "name": "v1", "dataType": "string" } ``` - `type`: Must be "variable" - `selector`: JSONPath expression to extract the value - `name`: Field name in the output - `dataType`: Data type (string, number, boolean) ### Dataset Datasets represent tabular data with multiple rows and columns. ```json { "type": "dataset", "name": "table_data", "selector": "$.nested.nested_2", "columns": [ { "name": "id", "selector": "$[*]", "dataType": "number" }, { "name": "value", "selector": "$root:$.additionalData[*].val", "dataType": "number" } ] } ``` - `type`: Must be "dataset" - `name`: Dataset name in the output - `selector`: JSONPath expression to extract the dataset - `columns`: Array of column definitions - `name`: Column name - `selector`: JSONPath expression to extract column values - `dataType`: Data type (string, number, boolean) ## Root Reference The `$root:` prefix allows accessing data from the root context even when the current context is within a nested structure. ```json { "selector": "$root:$.additionalData[*].val" } ``` This is particularly useful in dataset column selectors when you need to reference data outside the current dataset context. ### Examples 1. Access root-level property from a nested dataset: ```json { "selector": "$root:$.metadata.version" } ``` 2. Access array elements from root while in a nested context: ```json { "selector": "$root:$.additionalData[*].val" } ``` 3. Use with filters: ```json { "selector": "$root:$.additionalData[?(@.name == 'N1')].values[*].val" } ``` 4. Reference field values in selectors: ```json { "selector": "$root:$.someData[?(@.test_name == '{field:test_name}')].capacity[*].value" } ``` This allows you to dynamically reference the value of another field (`test_name` in this example) within your selector. ## Split Data Data splitting allows creating multiple outputs from a single data source based on a specific value. ```json { "dataSplit": [ { "selector": "$['split1']", "variable": "location_code" } ] } ``` - `selector`: JSONPath expression to extract the split value - `variable`: Name of the variable to use in output ### Iterator Selectors You can use pipe (`|`) to iterate through arrays and create splits for each element: ```json { "dataSplit": [ { "selector": "$.sorters|$.sorter_name", "variable": "sorter_name" } ] } ``` In this example: - `$.sorters` selects an array of sorters - The pipe (`|`) indicates iteration through each element - `$.sorter_name` extracts the sorter name from each element - Each sorter name becomes a separate split
data-source.txt
· ostatnio zmienione: 2025/05/23 13:32 przez
damian.zabawa
Narzędzia strony
Pokaż stronę
Poprzednie wersje
Odnośniki
Do góry