Browse scripts are associated with extensible connections and are used to discover source systems. There are a number of environment variables and token replacements available to developers when writing browse scripts. All browse scripts must return information about the source model in a specific JSON format.

Environment variables scripts

The following script environment variables are available to all browse scripts.

Variable

Description

WSL_SRCCFG_<configured_field_name>

The values of configured connection properties can be accessed using environment variables.

WSL_BINDIR

The WhereScape 3D installation path. (The default location is 'C:\Program Files\WhereScape\WhereScape 3D'.)

WSL_WORKDIR

The working directory where the script is executed. (The working directory will be in %UserProfile%\WhereScape\3D\scriptExecution.)

WSL_TASK_NAME

A name used to identify the browse script discovery task.

WSL_SEQUENCE

A sequence id to identify each browse script discovery process.

WSL_SCRIPT_<Script_Name>_CODE

The full path to the script specified. The script should be stored in the WhereScape 3D metadata and will be automatically copied to the working directory before the workflow script is executed.

Token replacement in scripts

The values of configured connection properties can be accessed in browse scripts using the following token format which will be replaced at run-time: $WSL_SRCCFG_<cofigured_field_name>$

Browse Script Output

Each browse script should return a set of JSON which is used to define the discovered model. An example of the output required is displayed below.

{
  "treeViewLayout": "Tabular",
    "treeViewIcons": {
        "schema": "database.ico",
        "table": "table.ico"
    },
    "C:\\Program Files\\WhereScape\\RED\\Tutorial": {
        "budget.txt": {
            "name": "budget",
            "description": "budget table description",
            "rowCount": null,
            "columns": [{
                    "name": "product_code",
                    "dataType": "numeric",
                    "dataTypeLength": null,
                    "dataTypeScale": 6,
                    "dataTypePrecision": 0,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "budget.txt",
                    "sourceColumn": "COL1",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "customer_code",
                    "dataType": "numeric",
                    "dataTypeLength": null,
                    "dataTypeScale": 6,
                    "dataTypePrecision": 0,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "budget.txt",
                    "sourceColumn": "COL2",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "budget_quantity",
                    "dataType": "numeric",
                    "dataTypeLength": null,
                    "dataTypeScale": 8,
                    "dataTypePrecision": 0,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "budget.txt",
                    "sourceColumn": "COL3",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "budget_sales_value",
                    "dataType": "numeric",
                    "dataTypeLength": null,
                    "dataTypeScale": 8,
                    "dataTypePrecision": 2,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "budget.txt",
                    "sourceColumn": "COL4",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "budget_date",
                    "dataType": "datetime",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": 3,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "budget.txt",
                    "sourceColumn": "COL5",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }
            ],
            "loadInfo": {
                "fileLoaderOptions": "TABLOCK",
                "fileParsed": true,
                "overrideLoadSQL": "",
                "overrideSourceColumns": "",
                "selectDistinctValues": false,
                "sourceFile": {
                    "charSet": "",
                    "escapeEncoding": "",
                    "fieldDelimiter": ",",
                    "fieldEnclosure": "\"",
                    "headerLine": true,
                    "name": "budget.txt",
                    "nonStringNullEncoding": "",
                    "nullEncoding": "",
                    "path": "C:\\Program Files\\WhereScape\\RED\\Tutorial",     "(Source Directory)"
                    "recordDelimiter": ""
                },
                "sourceSchema": "",
                "sourceTables": "budget.txt",      
                "useOverrideSourceColumns": false,
                "whereAndGroupByClauses": ""
            },
            "uiConfigLoadTableProperties": {
                "fileType": "PARQUET",
                "tableField2": "value"
            }
        },
        "forecast.txt": {
            "name": "forecast",
            "description": "forecast table description",
            "rowCount": null,
            "columns": [{
                    "name": "product_code",
                    "dataType": "string",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": null,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "forecast.txt",
                    "sourceColumn": "COL1",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "customer_code",
                    "dataType": "string",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": null,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "forecast.txt",
                    "sourceColumn": "COL2",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "forecast_quantity",
                    "dataType": "string",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": null,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "forecast.txt",
                    "sourceColumn": "COL3",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "forecast_sales_value",
                    "dataType": "string",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": null,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "forecast.txt",
                    "sourceColumn": "COL4",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }, {
                    "name": "forecast_date",
                    "dataType": "string",
                    "dataTypeLength": null,
                    "dataTypeScale": null,
                    "dataTypePrecision": null,
                    "nullAllowed": true,
                    "defaultValue": "",
                    "description": "The physical shipping address of the customer.",
                    "displayName": "address",
                    "format": "",
                    "additive": false,
                    "numeric": false,
                    "attribute": false,
                    "sourceTable": "forecast.txt",
                    "sourceColumn": "COL5",
                    "transform": "",
                    "transformType": "",
                    "uiConfigColumnProperites": {
                        "columnField1": "value",
                        "columnField2": "value"
                    }
                }
            ],
            "loadInfo": {
                "fileLoaderOptions": "TABLOCK",
                "fileParsed": true,
                "overrideLoadSQL": "",
                "overrideSourceColumns": "",
                "selectDistinctValues": false,
                "sourceFile": {
                    "charSet": "",
                    "escapeEncoding": "",
                    "fieldDelimiter": ",",
                    "fieldEnclosure": "\"",
                    "headerLine": true,
                    "name": "budget.txt",
                    "nonStringNullEncoding": "",
                    "nullEncoding": "",
                    "path": "C:\\Program Files\\WhereScape\\RED\\Tutorial",
                    "recordDelimiter": ""
                },
                "sourceSchema": "",
                "sourceTables": "budget.txt",
                "useOverrideSourceColumns": false,
                "whereAndGroupByClauses": ""
            },
            "uiConfigLoadTableProperties": {
                "fileType": "PARQUET",
                "tableField2": "value"
            }
        }
    },
    "relations": [
            {
                  "fk_schema": "C:\\Program Files\\WhereScape\\RED\\Tutorial",
                  "fk_table": "budget",
                  "fk_column": "product_code",
                  "referenced_schema": "C:\\Program Files\\WhereScape\\RED\\Tutorial",
                  "referenced_table": "forecast",
                  "referenced_column": "product_code"
            }
    ]
}


  • No labels