workato-platform-cli 1.0.0rc5.dev5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- workato_platform_cli/__init__.py +135 -0
- workato_platform_cli/_version.py +34 -0
- workato_platform_cli/cli/__init__.py +126 -0
- workato_platform_cli/cli/commands/__init__.py +0 -0
- workato_platform_cli/cli/commands/api_clients.py +627 -0
- workato_platform_cli/cli/commands/api_collections.py +497 -0
- workato_platform_cli/cli/commands/assets.py +82 -0
- workato_platform_cli/cli/commands/connections.py +1205 -0
- workato_platform_cli/cli/commands/connectors/__init__.py +0 -0
- workato_platform_cli/cli/commands/connectors/command.py +178 -0
- workato_platform_cli/cli/commands/connectors/connector_manager.py +351 -0
- workato_platform_cli/cli/commands/data_tables.py +345 -0
- workato_platform_cli/cli/commands/guide.py +315 -0
- workato_platform_cli/cli/commands/init.py +229 -0
- workato_platform_cli/cli/commands/profiles.py +364 -0
- workato_platform_cli/cli/commands/projects/__init__.py +0 -0
- workato_platform_cli/cli/commands/projects/command.py +513 -0
- workato_platform_cli/cli/commands/projects/project_manager.py +338 -0
- workato_platform_cli/cli/commands/properties.py +174 -0
- workato_platform_cli/cli/commands/pull.py +327 -0
- workato_platform_cli/cli/commands/push/__init__.py +0 -0
- workato_platform_cli/cli/commands/push/command.py +320 -0
- workato_platform_cli/cli/commands/recipes/__init__.py +0 -0
- workato_platform_cli/cli/commands/recipes/command.py +847 -0
- workato_platform_cli/cli/commands/recipes/validator.py +1740 -0
- workato_platform_cli/cli/commands/workspace.py +73 -0
- workato_platform_cli/cli/containers.py +80 -0
- workato_platform_cli/cli/resources/data/connection-data.json +7364 -0
- workato_platform_cli/cli/resources/data/picklist-data.json +3706 -0
- workato_platform_cli/cli/resources/docs/README.md +178 -0
- workato_platform_cli/cli/resources/docs/actions.md +452 -0
- workato_platform_cli/cli/resources/docs/block-structure.md +424 -0
- workato_platform_cli/cli/resources/docs/connections-parameters.md +11946 -0
- workato_platform_cli/cli/resources/docs/data-mapping.md +779 -0
- workato_platform_cli/cli/resources/docs/formulas/array-list-formulas.md +1276 -0
- workato_platform_cli/cli/resources/docs/formulas/conditions.md +102 -0
- workato_platform_cli/cli/resources/docs/formulas/date-formulas.md +798 -0
- workato_platform_cli/cli/resources/docs/formulas/number-formulas.md +507 -0
- workato_platform_cli/cli/resources/docs/formulas/other-formulas.md +419 -0
- workato_platform_cli/cli/resources/docs/formulas/string-formulas.md +1353 -0
- workato_platform_cli/cli/resources/docs/formulas.md +214 -0
- workato_platform_cli/cli/resources/docs/naming-conventions.md +163 -0
- workato_platform_cli/cli/resources/docs/recipe-deployment-workflow.md +352 -0
- workato_platform_cli/cli/resources/docs/recipe-fundamentals.md +179 -0
- workato_platform_cli/cli/resources/docs/triggers.md +360 -0
- workato_platform_cli/cli/utils/__init__.py +10 -0
- workato_platform_cli/cli/utils/config/__init__.py +33 -0
- workato_platform_cli/cli/utils/config/manager.py +1001 -0
- workato_platform_cli/cli/utils/config/models.py +89 -0
- workato_platform_cli/cli/utils/config/profiles.py +491 -0
- workato_platform_cli/cli/utils/config/workspace.py +113 -0
- workato_platform_cli/cli/utils/exception_handler.py +531 -0
- workato_platform_cli/cli/utils/gitignore.py +32 -0
- workato_platform_cli/cli/utils/ignore_patterns.py +44 -0
- workato_platform_cli/cli/utils/spinner.py +63 -0
- workato_platform_cli/cli/utils/version_checker.py +237 -0
- workato_platform_cli/client/__init__.py +0 -0
- workato_platform_cli/client/workato_api/__init__.py +202 -0
- workato_platform_cli/client/workato_api/api/__init__.py +15 -0
- workato_platform_cli/client/workato_api/api/api_platform_api.py +2875 -0
- workato_platform_cli/client/workato_api/api/connections_api.py +1807 -0
- workato_platform_cli/client/workato_api/api/connectors_api.py +840 -0
- workato_platform_cli/client/workato_api/api/data_tables_api.py +604 -0
- workato_platform_cli/client/workato_api/api/export_api.py +621 -0
- workato_platform_cli/client/workato_api/api/folders_api.py +621 -0
- workato_platform_cli/client/workato_api/api/packages_api.py +1197 -0
- workato_platform_cli/client/workato_api/api/projects_api.py +590 -0
- workato_platform_cli/client/workato_api/api/properties_api.py +620 -0
- workato_platform_cli/client/workato_api/api/recipes_api.py +1379 -0
- workato_platform_cli/client/workato_api/api/users_api.py +285 -0
- workato_platform_cli/client/workato_api/api_client.py +807 -0
- workato_platform_cli/client/workato_api/api_response.py +21 -0
- workato_platform_cli/client/workato_api/configuration.py +601 -0
- workato_platform_cli/client/workato_api/docs/APIPlatformApi.md +844 -0
- workato_platform_cli/client/workato_api/docs/ApiClient.md +46 -0
- workato_platform_cli/client/workato_api/docs/ApiClientApiCollectionsInner.md +30 -0
- workato_platform_cli/client/workato_api/docs/ApiClientApiPoliciesInner.md +30 -0
- workato_platform_cli/client/workato_api/docs/ApiClientCreateRequest.md +46 -0
- workato_platform_cli/client/workato_api/docs/ApiClientListResponse.md +32 -0
- workato_platform_cli/client/workato_api/docs/ApiClientResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/ApiCollection.md +38 -0
- workato_platform_cli/client/workato_api/docs/ApiCollectionCreateRequest.md +32 -0
- workato_platform_cli/client/workato_api/docs/ApiEndpoint.md +41 -0
- workato_platform_cli/client/workato_api/docs/ApiKey.md +36 -0
- workato_platform_cli/client/workato_api/docs/ApiKeyCreateRequest.md +32 -0
- workato_platform_cli/client/workato_api/docs/ApiKeyListResponse.md +32 -0
- workato_platform_cli/client/workato_api/docs/ApiKeyResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/Asset.md +39 -0
- workato_platform_cli/client/workato_api/docs/AssetReference.md +37 -0
- workato_platform_cli/client/workato_api/docs/Connection.md +44 -0
- workato_platform_cli/client/workato_api/docs/ConnectionCreateRequest.md +35 -0
- workato_platform_cli/client/workato_api/docs/ConnectionUpdateRequest.md +34 -0
- workato_platform_cli/client/workato_api/docs/ConnectionsApi.md +526 -0
- workato_platform_cli/client/workato_api/docs/ConnectorAction.md +33 -0
- workato_platform_cli/client/workato_api/docs/ConnectorVersion.md +32 -0
- workato_platform_cli/client/workato_api/docs/ConnectorsApi.md +249 -0
- workato_platform_cli/client/workato_api/docs/CreateExportManifestRequest.md +29 -0
- workato_platform_cli/client/workato_api/docs/CreateFolderRequest.md +30 -0
- workato_platform_cli/client/workato_api/docs/CustomConnector.md +35 -0
- workato_platform_cli/client/workato_api/docs/CustomConnectorCodeResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/CustomConnectorCodeResponseData.md +29 -0
- workato_platform_cli/client/workato_api/docs/CustomConnectorListResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/DataTable.md +34 -0
- workato_platform_cli/client/workato_api/docs/DataTableColumn.md +37 -0
- workato_platform_cli/client/workato_api/docs/DataTableColumnRequest.md +37 -0
- workato_platform_cli/client/workato_api/docs/DataTableCreateRequest.md +31 -0
- workato_platform_cli/client/workato_api/docs/DataTableCreateResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/DataTableListResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/DataTableRelation.md +30 -0
- workato_platform_cli/client/workato_api/docs/DataTablesApi.md +172 -0
- workato_platform_cli/client/workato_api/docs/DeleteProject403Response.md +29 -0
- workato_platform_cli/client/workato_api/docs/Error.md +29 -0
- workato_platform_cli/client/workato_api/docs/ExportApi.md +175 -0
- workato_platform_cli/client/workato_api/docs/ExportManifestRequest.md +35 -0
- workato_platform_cli/client/workato_api/docs/ExportManifestResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/ExportManifestResponseResult.md +36 -0
- workato_platform_cli/client/workato_api/docs/Folder.md +35 -0
- workato_platform_cli/client/workato_api/docs/FolderAssetsResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/FolderAssetsResponseResult.md +29 -0
- workato_platform_cli/client/workato_api/docs/FolderCreationResponse.md +35 -0
- workato_platform_cli/client/workato_api/docs/FoldersApi.md +176 -0
- workato_platform_cli/client/workato_api/docs/ImportResults.md +32 -0
- workato_platform_cli/client/workato_api/docs/OAuthUrlResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/OAuthUrlResponseData.md +29 -0
- workato_platform_cli/client/workato_api/docs/OpenApiSpec.md +30 -0
- workato_platform_cli/client/workato_api/docs/PackageDetailsResponse.md +35 -0
- workato_platform_cli/client/workato_api/docs/PackageDetailsResponseRecipeStatusInner.md +30 -0
- workato_platform_cli/client/workato_api/docs/PackageResponse.md +33 -0
- workato_platform_cli/client/workato_api/docs/PackagesApi.md +364 -0
- workato_platform_cli/client/workato_api/docs/PicklistRequest.md +30 -0
- workato_platform_cli/client/workato_api/docs/PicklistResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/PlatformConnector.md +36 -0
- workato_platform_cli/client/workato_api/docs/PlatformConnectorListResponse.md +32 -0
- workato_platform_cli/client/workato_api/docs/Project.md +32 -0
- workato_platform_cli/client/workato_api/docs/ProjectsApi.md +173 -0
- workato_platform_cli/client/workato_api/docs/PropertiesApi.md +186 -0
- workato_platform_cli/client/workato_api/docs/Recipe.md +58 -0
- workato_platform_cli/client/workato_api/docs/RecipeConfigInner.md +33 -0
- workato_platform_cli/client/workato_api/docs/RecipeConnectionUpdateRequest.md +30 -0
- workato_platform_cli/client/workato_api/docs/RecipeListResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/RecipeStartResponse.md +31 -0
- workato_platform_cli/client/workato_api/docs/RecipesApi.md +367 -0
- workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionCreateRequest.md +34 -0
- workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionResponseData.md +30 -0
- workato_platform_cli/client/workato_api/docs/SuccessResponse.md +29 -0
- workato_platform_cli/client/workato_api/docs/UpsertProjectPropertiesRequest.md +29 -0
- workato_platform_cli/client/workato_api/docs/User.md +48 -0
- workato_platform_cli/client/workato_api/docs/UsersApi.md +84 -0
- workato_platform_cli/client/workato_api/docs/ValidationError.md +30 -0
- workato_platform_cli/client/workato_api/docs/ValidationErrorErrorsValue.md +28 -0
- workato_platform_cli/client/workato_api/exceptions.py +216 -0
- workato_platform_cli/client/workato_api/models/__init__.py +83 -0
- workato_platform_cli/client/workato_api/models/api_client.py +185 -0
- workato_platform_cli/client/workato_api/models/api_client_api_collections_inner.py +89 -0
- workato_platform_cli/client/workato_api/models/api_client_api_policies_inner.py +89 -0
- workato_platform_cli/client/workato_api/models/api_client_create_request.py +138 -0
- workato_platform_cli/client/workato_api/models/api_client_list_response.py +101 -0
- workato_platform_cli/client/workato_api/models/api_client_response.py +91 -0
- workato_platform_cli/client/workato_api/models/api_collection.py +110 -0
- workato_platform_cli/client/workato_api/models/api_collection_create_request.py +97 -0
- workato_platform_cli/client/workato_api/models/api_endpoint.py +117 -0
- workato_platform_cli/client/workato_api/models/api_key.py +102 -0
- workato_platform_cli/client/workato_api/models/api_key_create_request.py +93 -0
- workato_platform_cli/client/workato_api/models/api_key_list_response.py +101 -0
- workato_platform_cli/client/workato_api/models/api_key_response.py +91 -0
- workato_platform_cli/client/workato_api/models/asset.py +124 -0
- workato_platform_cli/client/workato_api/models/asset_reference.py +110 -0
- workato_platform_cli/client/workato_api/models/connection.py +173 -0
- workato_platform_cli/client/workato_api/models/connection_create_request.py +99 -0
- workato_platform_cli/client/workato_api/models/connection_update_request.py +97 -0
- workato_platform_cli/client/workato_api/models/connector_action.py +100 -0
- workato_platform_cli/client/workato_api/models/connector_version.py +99 -0
- workato_platform_cli/client/workato_api/models/create_export_manifest_request.py +91 -0
- workato_platform_cli/client/workato_api/models/create_folder_request.py +89 -0
- workato_platform_cli/client/workato_api/models/custom_connector.py +117 -0
- workato_platform_cli/client/workato_api/models/custom_connector_code_response.py +91 -0
- workato_platform_cli/client/workato_api/models/custom_connector_code_response_data.py +87 -0
- workato_platform_cli/client/workato_api/models/custom_connector_list_response.py +95 -0
- workato_platform_cli/client/workato_api/models/data_table.py +107 -0
- workato_platform_cli/client/workato_api/models/data_table_column.py +125 -0
- workato_platform_cli/client/workato_api/models/data_table_column_request.py +130 -0
- workato_platform_cli/client/workato_api/models/data_table_create_request.py +99 -0
- workato_platform_cli/client/workato_api/models/data_table_create_response.py +91 -0
- workato_platform_cli/client/workato_api/models/data_table_list_response.py +95 -0
- workato_platform_cli/client/workato_api/models/data_table_relation.py +90 -0
- workato_platform_cli/client/workato_api/models/delete_project403_response.py +87 -0
- workato_platform_cli/client/workato_api/models/error.py +87 -0
- workato_platform_cli/client/workato_api/models/export_manifest_request.py +107 -0
- workato_platform_cli/client/workato_api/models/export_manifest_response.py +91 -0
- workato_platform_cli/client/workato_api/models/export_manifest_response_result.py +112 -0
- workato_platform_cli/client/workato_api/models/folder.py +110 -0
- workato_platform_cli/client/workato_api/models/folder_assets_response.py +91 -0
- workato_platform_cli/client/workato_api/models/folder_assets_response_result.py +95 -0
- workato_platform_cli/client/workato_api/models/folder_creation_response.py +110 -0
- workato_platform_cli/client/workato_api/models/import_results.py +93 -0
- workato_platform_cli/client/workato_api/models/o_auth_url_response.py +91 -0
- workato_platform_cli/client/workato_api/models/o_auth_url_response_data.py +87 -0
- workato_platform_cli/client/workato_api/models/open_api_spec.py +96 -0
- workato_platform_cli/client/workato_api/models/package_details_response.py +126 -0
- workato_platform_cli/client/workato_api/models/package_details_response_recipe_status_inner.py +99 -0
- workato_platform_cli/client/workato_api/models/package_response.py +109 -0
- workato_platform_cli/client/workato_api/models/picklist_request.py +89 -0
- workato_platform_cli/client/workato_api/models/picklist_response.py +88 -0
- workato_platform_cli/client/workato_api/models/platform_connector.py +116 -0
- workato_platform_cli/client/workato_api/models/platform_connector_list_response.py +101 -0
- workato_platform_cli/client/workato_api/models/project.py +93 -0
- workato_platform_cli/client/workato_api/models/recipe.py +174 -0
- workato_platform_cli/client/workato_api/models/recipe_config_inner.py +100 -0
- workato_platform_cli/client/workato_api/models/recipe_connection_update_request.py +89 -0
- workato_platform_cli/client/workato_api/models/recipe_list_response.py +95 -0
- workato_platform_cli/client/workato_api/models/recipe_start_response.py +91 -0
- workato_platform_cli/client/workato_api/models/runtime_user_connection_create_request.py +97 -0
- workato_platform_cli/client/workato_api/models/runtime_user_connection_response.py +91 -0
- workato_platform_cli/client/workato_api/models/runtime_user_connection_response_data.py +89 -0
- workato_platform_cli/client/workato_api/models/success_response.py +87 -0
- workato_platform_cli/client/workato_api/models/upsert_project_properties_request.py +88 -0
- workato_platform_cli/client/workato_api/models/user.py +151 -0
- workato_platform_cli/client/workato_api/models/validation_error.py +102 -0
- workato_platform_cli/client/workato_api/models/validation_error_errors_value.py +143 -0
- workato_platform_cli/client/workato_api/rest.py +213 -0
- workato_platform_cli/client/workato_api/test/__init__.py +0 -0
- workato_platform_cli/client/workato_api/test/test_api_client.py +94 -0
- workato_platform_cli/client/workato_api/test/test_api_client_api_collections_inner.py +52 -0
- workato_platform_cli/client/workato_api/test/test_api_client_api_policies_inner.py +52 -0
- workato_platform_cli/client/workato_api/test/test_api_client_create_request.py +75 -0
- workato_platform_cli/client/workato_api/test/test_api_client_list_response.py +114 -0
- workato_platform_cli/client/workato_api/test/test_api_client_response.py +104 -0
- workato_platform_cli/client/workato_api/test/test_api_collection.py +72 -0
- workato_platform_cli/client/workato_api/test/test_api_collection_create_request.py +57 -0
- workato_platform_cli/client/workato_api/test/test_api_endpoint.py +75 -0
- workato_platform_cli/client/workato_api/test/test_api_key.py +64 -0
- workato_platform_cli/client/workato_api/test/test_api_key_create_request.py +56 -0
- workato_platform_cli/client/workato_api/test/test_api_key_list_response.py +78 -0
- workato_platform_cli/client/workato_api/test/test_api_key_response.py +68 -0
- workato_platform_cli/client/workato_api/test/test_api_platform_api.py +101 -0
- workato_platform_cli/client/workato_api/test/test_asset.py +67 -0
- workato_platform_cli/client/workato_api/test/test_asset_reference.py +62 -0
- workato_platform_cli/client/workato_api/test/test_connection.py +81 -0
- workato_platform_cli/client/workato_api/test/test_connection_create_request.py +59 -0
- workato_platform_cli/client/workato_api/test/test_connection_update_request.py +56 -0
- workato_platform_cli/client/workato_api/test/test_connections_api.py +73 -0
- workato_platform_cli/client/workato_api/test/test_connector_action.py +59 -0
- workato_platform_cli/client/workato_api/test/test_connector_version.py +58 -0
- workato_platform_cli/client/workato_api/test/test_connectors_api.py +52 -0
- workato_platform_cli/client/workato_api/test/test_create_export_manifest_request.py +88 -0
- workato_platform_cli/client/workato_api/test/test_create_folder_request.py +53 -0
- workato_platform_cli/client/workato_api/test/test_custom_connector.py +76 -0
- workato_platform_cli/client/workato_api/test/test_custom_connector_code_response.py +54 -0
- workato_platform_cli/client/workato_api/test/test_custom_connector_code_response_data.py +52 -0
- workato_platform_cli/client/workato_api/test/test_custom_connector_list_response.py +82 -0
- workato_platform_cli/client/workato_api/test/test_data_table.py +88 -0
- workato_platform_cli/client/workato_api/test/test_data_table_column.py +72 -0
- workato_platform_cli/client/workato_api/test/test_data_table_column_request.py +64 -0
- workato_platform_cli/client/workato_api/test/test_data_table_create_request.py +82 -0
- workato_platform_cli/client/workato_api/test/test_data_table_create_response.py +90 -0
- workato_platform_cli/client/workato_api/test/test_data_table_list_response.py +94 -0
- workato_platform_cli/client/workato_api/test/test_data_table_relation.py +54 -0
- workato_platform_cli/client/workato_api/test/test_data_tables_api.py +45 -0
- workato_platform_cli/client/workato_api/test/test_delete_project403_response.py +51 -0
- workato_platform_cli/client/workato_api/test/test_error.py +52 -0
- workato_platform_cli/client/workato_api/test/test_export_api.py +45 -0
- workato_platform_cli/client/workato_api/test/test_export_manifest_request.py +69 -0
- workato_platform_cli/client/workato_api/test/test_export_manifest_response.py +68 -0
- workato_platform_cli/client/workato_api/test/test_export_manifest_response_result.py +66 -0
- workato_platform_cli/client/workato_api/test/test_folder.py +64 -0
- workato_platform_cli/client/workato_api/test/test_folder_assets_response.py +80 -0
- workato_platform_cli/client/workato_api/test/test_folder_assets_response_result.py +78 -0
- workato_platform_cli/client/workato_api/test/test_folder_creation_response.py +64 -0
- workato_platform_cli/client/workato_api/test/test_folders_api.py +45 -0
- workato_platform_cli/client/workato_api/test/test_import_results.py +58 -0
- workato_platform_cli/client/workato_api/test/test_o_auth_url_response.py +54 -0
- workato_platform_cli/client/workato_api/test/test_o_auth_url_response_data.py +52 -0
- workato_platform_cli/client/workato_api/test/test_open_api_spec.py +54 -0
- workato_platform_cli/client/workato_api/test/test_package_details_response.py +64 -0
- workato_platform_cli/client/workato_api/test/test_package_details_response_recipe_status_inner.py +52 -0
- workato_platform_cli/client/workato_api/test/test_package_response.py +58 -0
- workato_platform_cli/client/workato_api/test/test_packages_api.py +59 -0
- workato_platform_cli/client/workato_api/test/test_picklist_request.py +53 -0
- workato_platform_cli/client/workato_api/test/test_picklist_response.py +52 -0
- workato_platform_cli/client/workato_api/test/test_platform_connector.py +94 -0
- workato_platform_cli/client/workato_api/test/test_platform_connector_list_response.py +106 -0
- workato_platform_cli/client/workato_api/test/test_project.py +57 -0
- workato_platform_cli/client/workato_api/test/test_projects_api.py +45 -0
- workato_platform_cli/client/workato_api/test/test_properties_api.py +45 -0
- workato_platform_cli/client/workato_api/test/test_recipe.py +124 -0
- workato_platform_cli/client/workato_api/test/test_recipe_config_inner.py +55 -0
- workato_platform_cli/client/workato_api/test/test_recipe_connection_update_request.py +54 -0
- workato_platform_cli/client/workato_api/test/test_recipe_list_response.py +134 -0
- workato_platform_cli/client/workato_api/test/test_recipe_start_response.py +54 -0
- workato_platform_cli/client/workato_api/test/test_recipes_api.py +59 -0
- workato_platform_cli/client/workato_api/test/test_runtime_user_connection_create_request.py +59 -0
- workato_platform_cli/client/workato_api/test/test_runtime_user_connection_response.py +56 -0
- workato_platform_cli/client/workato_api/test/test_runtime_user_connection_response_data.py +54 -0
- workato_platform_cli/client/workato_api/test/test_success_response.py +52 -0
- workato_platform_cli/client/workato_api/test/test_upsert_project_properties_request.py +52 -0
- workato_platform_cli/client/workato_api/test/test_user.py +85 -0
- workato_platform_cli/client/workato_api/test/test_users_api.py +38 -0
- workato_platform_cli/client/workato_api/test/test_validation_error.py +52 -0
- workato_platform_cli/client/workato_api/test/test_validation_error_errors_value.py +50 -0
- workato_platform_cli/client/workato_api_README.md +205 -0
- workato_platform_cli-1.0.0rc5.dev5.dist-info/METADATA +185 -0
- workato_platform_cli-1.0.0rc5.dev5.dist-info/RECORD +306 -0
- workato_platform_cli-1.0.0rc5.dev5.dist-info/WHEEL +4 -0
- workato_platform_cli-1.0.0rc5.dev5.dist-info/entry_points.txt +2 -0
- workato_platform_cli-1.0.0rc5.dev5.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,1276 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: List and Hash Formulas
|
|
3
|
+
date: 2022-01-03 05:00:00 Z
|
|
4
|
+
page_nav_depth: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# List and Hash formulas
|
|
8
|
+
|
|
9
|
+
In addition to the basic data types (for example, string and integer), you may encounter more complex data structures that contain information about multiple items or multiple pieces of information about a single item.
|
|
10
|
+
|
|
11
|
+
You may encounter these data structures:
|
|
12
|
+
|
|
13
|
+
- [Lists](#lists-arrays) (also known as arrays)
|
|
14
|
+
- [Hashes](#hashes)
|
|
15
|
+
- [List of hashes](#lists-of-hashes)
|
|
16
|
+
|
|
17
|
+
Formulas in Workato are added to allowlists for Ruby methods. Only allowlisted Ruby methods are supported. To request the addition of new formulas to the allowlist, [submit a support ticket](https://support.workato.com/en/support/tickets/new).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Lists (arrays)
|
|
22
|
+
|
|
23
|
+
Arrays are ordered, integer-indexed collections of any object. List indexing starts at 0. Lists and arrays refer to the same data structure.
|
|
24
|
+
|
|
25
|
+
In the example below, a list of integers is expressed as:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
number_list = [100, 101, 102, 103, 104]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
As lists are ordered, we can use the following formula to get the values. Workato only supports retrieving up to the fifth item using this syntax.
|
|
32
|
+
|
|
33
|
+
| Formula | Result |
|
|
34
|
+
| ------------------ | ------ |
|
|
35
|
+
| number_list.first | 100 |
|
|
36
|
+
| number_list.second | 101 |
|
|
37
|
+
| number_list.third | 102 |
|
|
38
|
+
| number_list.fourth | 103 |
|
|
39
|
+
| number_list.fifth | 104 |
|
|
40
|
+
| number_list.last | 104 |
|
|
41
|
+
|
|
42
|
+
We can also use indexes to get corresponding values. Remember, indexes start at 0:
|
|
43
|
+
|
|
44
|
+
| Formula | Result |
|
|
45
|
+
| -------------- | ------ |
|
|
46
|
+
| number_list[0] | 100 |
|
|
47
|
+
| number_list[1] | 101 |
|
|
48
|
+
| number_list[2] | 102 |
|
|
49
|
+
| number_list[3] | 103 |
|
|
50
|
+
|
|
51
|
+
Lists in Ruby supports negative indexes.
|
|
52
|
+
|
|
53
|
+
| Formula | Result |
|
|
54
|
+
| --------------- | ------ |
|
|
55
|
+
| number_list[-1] | 104 |
|
|
56
|
+
| number_list[-2] | 103 |
|
|
57
|
+
| number_list[-3] | 102 |
|
|
58
|
+
| number_list[-4] | 101 |
|
|
59
|
+
|
|
60
|
+
Lists also support ranges as indexes. This returns another list, instead of returning only a value.
|
|
61
|
+
|
|
62
|
+
| Formula | Result |
|
|
63
|
+
| ------------------- | -------------------- |
|
|
64
|
+
| number_list[0..2] | [100, 101, 102] |
|
|
65
|
+
| number_list[-3..-1] | [102, 103, 104] |
|
|
66
|
+
| number_list[0..-2] | [100, 101, 102, 103] |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Hashes
|
|
71
|
+
|
|
72
|
+
A hash is a dictionary-like collection of unique keys and their values. They are similar to Lists, but where a List uses integers as its index, a Hash allows you to use any object type. Hashes enumerate their values in the order that the corresponding keys were inserted.
|
|
73
|
+
|
|
74
|
+
Let's take the example of a hash with 2 values, with `'Acme widgets'` and `10` as the values of item_name and item_quantity respectively.
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
line_item = { 'item_name' => 'Acme widgets', 'item_qty' => 10 }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Formula | Result |
|
|
81
|
+
| ---------------------- | -------------- |
|
|
82
|
+
| line_item["item_name"] | "Acme widgets" |
|
|
83
|
+
| line_item["item_qty"] | 10 |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Lists of hashes
|
|
88
|
+
|
|
89
|
+
Here is an example of an invoice which has multiple line items. It is represented as a list of hashes.
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
line_items = [
|
|
93
|
+
{ 'item_no': 1, 'item_name' => 'Acme widgets', 'item_qty' => 10 },
|
|
94
|
+
{ 'item_no': 2, 'item_name' => 'RR bearings', 'item_qty' => 99 },
|
|
95
|
+
{ 'item_no': 3, 'item_name' => 'Coyote tyres', 'item_qty' => 7 }
|
|
96
|
+
]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Example list of hashes
|
|
102
|
+
|
|
103
|
+
The following is an example of a list of hashes called **Contacts**.
|
|
104
|
+
|
|
105
|
+
This is the Contacts list in a table form:
|
|
106
|
+
|
|
107
|
+
| name | email | state | company | company_rev |
|
|
108
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
109
|
+
| Joe | joe@abc.om | CA | ABC | 1000 |
|
|
110
|
+
| Jill | jill@nbc.com | MA | NBC | 1000 |
|
|
111
|
+
| Joan | joan@nbc.com | MA | NBC | 10000 |
|
|
112
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
113
|
+
|
|
114
|
+
This is the Contacts list in a list of hashes form.
|
|
115
|
+
|
|
116
|
+
```ruby
|
|
117
|
+
[
|
|
118
|
+
{
|
|
119
|
+
'name' => 'Joe',
|
|
120
|
+
'email' => 'joe@abc.com',
|
|
121
|
+
'state' => 'CA',
|
|
122
|
+
'company' => 'ABC',
|
|
123
|
+
'company_rev' => 1000,
|
|
124
|
+
'description' => { 'summary' => 'First time buyer', 'estimated_value' => 300 }
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
'name' => 'Jill',
|
|
128
|
+
'email' => 'jill@nbc.com',
|
|
129
|
+
'state' => 'MA',
|
|
130
|
+
'company' => 'NBC',
|
|
131
|
+
'company_rev' => 1000,
|
|
132
|
+
'description' => { 'summary' => 'Referral', 'estimated_value' => 500 }
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
'name' => 'Joan',
|
|
136
|
+
'email' => 'joan@nbc.com',
|
|
137
|
+
'state' => 'MA',
|
|
138
|
+
'company' => 'NBC',
|
|
139
|
+
'company_rev' => 10000,
|
|
140
|
+
'description' => { 'summary' => 'Recurring customer', 'estimated_value' => 900 }
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
'name' => 'Jack',
|
|
144
|
+
'email' => 'jack@hbo.com',
|
|
145
|
+
'state' => 'CA',
|
|
146
|
+
'company' => 'HBO',
|
|
147
|
+
'company_rev' => 30000,
|
|
148
|
+
'description' => { 'summary' => 'Recurring customer', 'estimated_value' => 1000 }
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
```
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## List formulas
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `first`
|
|
159
|
+
|
|
160
|
+
This formula returns the first item in a list.
|
|
161
|
+
|
|
162
|
+
It can also be used to return the first _n_ items in a list. In this case, the output will be formatted as a list.
|
|
163
|
+
|
|
164
|
+
#### Syntax
|
|
165
|
+
|
|
166
|
+
<kbd>List</kbd>.first(<span style="color:#FF0000">number</span>)
|
|
167
|
+
|
|
168
|
+
- <kbd>List</kbd> - An input list.
|
|
169
|
+
- <span style="color:#FF0000">number</span> - (optional) The number of items to retrieve from the list. If not specified, the formula will return only _one_ item.
|
|
170
|
+
|
|
171
|
+
#### Sample usage
|
|
172
|
+
|
|
173
|
+
| Formula | Result |
|
|
174
|
+
| ------------------------------------------------------- | ------------- |
|
|
175
|
+
| <kbd>["One","Two","Three","Four","Five"]</kbd>.first() | "One" |
|
|
176
|
+
| <kbd>["One","Two","Three","Four","Five"]</kbd>.first(2) | ["One","Two"] |
|
|
177
|
+
| <kbd>[1,2,3,4,5]</kbd>.first() | 1 |
|
|
178
|
+
| <kbd>[1,2,3,4,5]</kbd>.first(3) | [1,2,3] |
|
|
179
|
+
|
|
180
|
+
#### How it works
|
|
181
|
+
|
|
182
|
+
This formula returns the first _n_ items from a list. If _n_ is greater than one, the output is formatted as a list.
|
|
183
|
+
|
|
184
|
+
::: tip Output datatype
|
|
185
|
+
If you are returning a single item (i.e. no arguments provided). The output will be formatted according to the item's datatype.
|
|
186
|
+
|
|
187
|
+
If you are returning more than _one_ item. The output will be formatted as a list datatype.
|
|
188
|
+
:::
|
|
189
|
+
|
|
190
|
+
#### See also
|
|
191
|
+
|
|
192
|
+
- [last](/formulas/array-list-formulas.md#last): Returns the last _n_ items in a list.
|
|
193
|
+
- [where](/formulas/array-list-formulas.md#where): Returns a subset of list items that meet a certain condition.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### `last`
|
|
198
|
+
|
|
199
|
+
This formula returns the last item in a list.
|
|
200
|
+
|
|
201
|
+
It can also be used to return the last _n_ items in a list. In this case, the output will be formatted as a list.
|
|
202
|
+
|
|
203
|
+
#### Syntax
|
|
204
|
+
|
|
205
|
+
<kbd>List</kbd>.last(<span style="color:#FF0000">number</span>)
|
|
206
|
+
|
|
207
|
+
- <kbd>List</kbd> - An input list.
|
|
208
|
+
- <span style="color:#FF0000">number</span> - (optional) The number of items to retrieve from the list. If not specified, the formula will return only _one_ item.
|
|
209
|
+
|
|
210
|
+
#### Sample usage
|
|
211
|
+
|
|
212
|
+
| Formula | Result |
|
|
213
|
+
| ------------------------------------------------------- | --------------- |
|
|
214
|
+
| <kbd> ["One","Two","Three","Four","Five"]</kbd>.last() | "Five" |
|
|
215
|
+
| <kbd> ["One","Two","Three","Four","Five"]</kbd>.last(2) | ["Four","Five"] |
|
|
216
|
+
| <kbd>[1,2,3,4,5]</kbd>.last() | 5 |
|
|
217
|
+
| <kbd>[1,2,3,4,5]</kbd>.last(3) | [3,4,5] |
|
|
218
|
+
|
|
219
|
+
#### How it works
|
|
220
|
+
|
|
221
|
+
This formula returns the last _n_ items from a list. If _n_ is greater than one, the output is formatted as a list.
|
|
222
|
+
|
|
223
|
+
::: tip Output datatype
|
|
224
|
+
If you are returning a single item (i.e. no arguments provided). The output will be formatted according to the item's datatype.
|
|
225
|
+
|
|
226
|
+
If you are returning more than _one_ item. The output will be formatted as a list datatype.
|
|
227
|
+
:::
|
|
228
|
+
|
|
229
|
+
#### See also
|
|
230
|
+
|
|
231
|
+
- [first](/formulas/array-list-formulas.md#first): Returns the first _n_ items in a list.
|
|
232
|
+
- [where](/formulas/array-list-formulas.md#where): Returns a subset of list items that meet a certain condition.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### `index`
|
|
237
|
+
|
|
238
|
+
Returns the index of the first item matching the given value. Returns `nil` if no matching items are found.
|
|
239
|
+
|
|
240
|
+
#### Syntax
|
|
241
|
+
|
|
242
|
+
<kbd>Input</kbd>.index(<span style="color:#FF0000">value</span>)
|
|
243
|
+
|
|
244
|
+
- <kbd>Input</kbd> - An input list.
|
|
245
|
+
- <span style="color:#FF0000">value</span> - The value to search for in the list.
|
|
246
|
+
|
|
247
|
+
#### Sample usage
|
|
248
|
+
|
|
249
|
+
| Formula | Result |
|
|
250
|
+
| --------------------- | ------ |
|
|
251
|
+
| [4, 5, 6, 7].index(6) | 2 |
|
|
252
|
+
| [4, 5, 6, 7].index(8) | nil |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### `count`
|
|
257
|
+
|
|
258
|
+
Returns the number of items in a list.
|
|
259
|
+
|
|
260
|
+
#### Syntax
|
|
261
|
+
|
|
262
|
+
`List`.count
|
|
263
|
+
|
|
264
|
+
- `List` - An input of list datatype.
|
|
265
|
+
|
|
266
|
+
#### Sample usage
|
|
267
|
+
|
|
268
|
+
| Formula | Result |
|
|
269
|
+
| ------- | ------ |
|
|
270
|
+
| `["Hello", "World", "Cat", "Dog"]`.count | 4 |
|
|
271
|
+
| `["Hello", "World", ["Sub-array", "Here"]]`.count | 3 |
|
|
272
|
+
| `["Hello", "World", nil, ["Sub-array", "Here"]]`.count | 4 |
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### `where`
|
|
277
|
+
|
|
278
|
+
Retrieves only the rows (hashes) which satisfy the specified WHERE condition. This formula accepts a single argument in the form of a hash with one or more key-value pairs.
|
|
279
|
+
|
|
280
|
+
The default operand for the condition is **equal to** (`==`). This formula also supports the following operands. Operands should be added to the end of key separated by a space.
|
|
281
|
+
|
|
282
|
+
| Name | Notation | Example |
|
|
283
|
+
| --------------------- | -------- | ---------------------------------------- |
|
|
284
|
+
| Equal to (default) | == | leads.where('state': 'CA') |
|
|
285
|
+
| More than | > | leads.where('company_revenue >': 10000) |
|
|
286
|
+
| More than or equal to | >= | leads.where('company_revenue >=': 10000) |
|
|
287
|
+
| Less than | < | leads.where('company_revenue <': 10000) |
|
|
288
|
+
| Less than or equal to | <= | leads.where('company_revenue <=': 10000) |
|
|
289
|
+
| Not equal to | != | leads.where('state !=': 'CA') |
|
|
290
|
+
|
|
291
|
+
::: tip Use datapills as the conditional argument
|
|
292
|
+
Instead of using a static value (for example, `'CA'`), you can use a datapill as the conditional argument. The value of the datapill will be processed at run-time.
|
|
293
|
+
|
|
294
|
+
`contacts.where(state: ` <kbd>datapill</kbd> `)`
|
|
295
|
+
:::
|
|
296
|
+
|
|
297
|
+
#### Sample usage
|
|
298
|
+
|
|
299
|
+
::: details Example of a single where condition
|
|
300
|
+
`contacts.where('state': 'CA')` returns the following rows:
|
|
301
|
+
|
|
302
|
+
| name | email | state | company | company_rev |
|
|
303
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
304
|
+
| Joe | joe@abc.om | CA | ABC | 1000 |
|
|
305
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
306
|
+
|
|
307
|
+
These rows will be expressed as a list of hashes:
|
|
308
|
+
|
|
309
|
+
```ruby
|
|
310
|
+
[
|
|
311
|
+
{
|
|
312
|
+
'name' => 'Joe',
|
|
313
|
+
'email' => 'joe@abc.com',
|
|
314
|
+
'state' => 'CA',
|
|
315
|
+
'company' => 'ABC',
|
|
316
|
+
'company_rev' => 1000
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
'name' => 'Jack',
|
|
320
|
+
'email' => 'jack@hbo.com',
|
|
321
|
+
'state' => 'CA',
|
|
322
|
+
'company' => 'HBO',
|
|
323
|
+
'company_rev' => 30000
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
:::
|
|
329
|
+
|
|
330
|
+
::: details Example of compound where formula
|
|
331
|
+
A compound WHERE formula will retrieve only the rows that matches all the conditions.
|
|
332
|
+
|
|
333
|
+
`contacts.where('state': 'CA', 'company_revenue >=': 10000)`
|
|
334
|
+
|
|
335
|
+
Returns the following rows:
|
|
336
|
+
|
|
337
|
+
| name | email | state | company | company_rev |
|
|
338
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
339
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
340
|
+
|
|
341
|
+
These rows will be expressed as a list of hashes:
|
|
342
|
+
|
|
343
|
+
```ruby
|
|
344
|
+
[
|
|
345
|
+
{
|
|
346
|
+
'name' => 'Jack',
|
|
347
|
+
'email' => 'jack@hbo.com',
|
|
348
|
+
'state' => 'CA',
|
|
349
|
+
'company' => 'HBO',
|
|
350
|
+
'company_rev' => 30000
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
::: danger Warning - MULTIPLE CONDITIONS IN A SINGLE KEY
|
|
358
|
+
|
|
359
|
+
Only the last condition is considered when you apply multiple conditions to the same key in a compound WHERE formula. This overrides previous conditions, and can lead to unexpected outcomes.
|
|
360
|
+
|
|
361
|
+
The following example shows that applying multiple conditions for `state`, returns only rows that contain the second `MA` key:
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
`contacts.where('state': 'CA', 'state': 'MA')`
|
|
365
|
+
|
|
366
|
+
returns only rows with states that are `MA`:
|
|
367
|
+
|
|
368
|
+
| name | email | state | company | company_rev |
|
|
369
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
370
|
+
| Jill | jill@nbc.com | MA | NBC | 1000 |
|
|
371
|
+
| Joan | joan@nbc.com | MA | NBC | 10000 |
|
|
372
|
+
|
|
373
|
+
These rows will be returned as a list of hashes.
|
|
374
|
+
|
|
375
|
+
```ruby
|
|
376
|
+
[
|
|
377
|
+
{
|
|
378
|
+
'name' => 'Jill',
|
|
379
|
+
'email' => 'jill@nbc.com',
|
|
380
|
+
'state' => 'MA',
|
|
381
|
+
'company' => 'NBC',
|
|
382
|
+
'company_rev' => 1000
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
'name' => 'Joan',
|
|
386
|
+
'email' => 'joan@nbc.com',
|
|
387
|
+
'state' => 'MA',
|
|
388
|
+
'company' => 'NBC',
|
|
389
|
+
'company_rev' => 10000
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
```
|
|
393
|
+
:::
|
|
394
|
+
|
|
395
|
+
::: details Example of multiple matches
|
|
396
|
+
You can filter out records based on a particular field against more than 1 value. This is done by passing an array value in the WHERE condition.
|
|
397
|
+
|
|
398
|
+
`contacts.where('company': ['ABC','HBO'])`
|
|
399
|
+
|
|
400
|
+
This WHERE condition will return rows where the company is either **ABC** or **HBO**:
|
|
401
|
+
|
|
402
|
+
| name | email | state | company | company_rev |
|
|
403
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
404
|
+
| Joe | joe@abc.om | CA | ABC | 1000 |
|
|
405
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
406
|
+
|
|
407
|
+
These rows will be returned as a list of hashes.
|
|
408
|
+
|
|
409
|
+
```ruby
|
|
410
|
+
[
|
|
411
|
+
{
|
|
412
|
+
'name' => 'Joe',
|
|
413
|
+
'email' => 'joe@abc.com',
|
|
414
|
+
'state' => 'CA',
|
|
415
|
+
'company' => 'ABC',
|
|
416
|
+
'company_rev' => 1000
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
'name' => 'Jack',
|
|
420
|
+
'email' => 'jack@hbo.com',
|
|
421
|
+
'state' => 'CA',
|
|
422
|
+
'company' => 'HBO',
|
|
423
|
+
'company_rev' => 30000
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
:::
|
|
429
|
+
|
|
430
|
+
::: details Example where condition with pattern matching
|
|
431
|
+
You can also filter out records using regex. This is done by passing a regex instead of a string.
|
|
432
|
+
|
|
433
|
+
`contacts.where('name': /^Jo/)`
|
|
434
|
+
|
|
435
|
+
This WHERE condition will return rows where the name starts with **Jo**:
|
|
436
|
+
|
|
437
|
+
| name | email | state | company | company_rev |
|
|
438
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
439
|
+
| Joe | joe@abc.om | CA | ABC | 1000 |
|
|
440
|
+
| Joan | joan@nbc.com | MA | NBC | 10000 |
|
|
441
|
+
|
|
442
|
+
These rows will be expressed as a list of hashes:
|
|
443
|
+
|
|
444
|
+
```ruby
|
|
445
|
+
[
|
|
446
|
+
{
|
|
447
|
+
'name' => 'Joe',
|
|
448
|
+
'email' => 'joe@abc.com',
|
|
449
|
+
'state' => 'CA',
|
|
450
|
+
'company' => 'ABC',
|
|
451
|
+
'company_rev' => 1000
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
'name' => 'Joan',
|
|
455
|
+
'email' => 'joan@nbc.com',
|
|
456
|
+
'state' => 'MA',
|
|
457
|
+
'company' => 'NBC',
|
|
458
|
+
'company_rev' => 10000
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
:::
|
|
464
|
+
|
|
465
|
+
::: details Example where condition with pattern matching (using datapills)
|
|
466
|
+
You may use data pills within a regex pattern to dynamically change the string that you are matching. However, using variables in a regex pattern requires escaping within the regex expression.
|
|
467
|
+
|
|
468
|
+
For example: `contacts.where(state: /#{` <kbd>datapill</kbd> `}/)`
|
|
469
|
+
|
|
470
|
+
The image below shows the method used to obtain all the 'Emails' in lookup table where the value in the 'State' column contains the string in the datapill from Salesforce, `State | Step 2`.
|
|
471
|
+
|
|
472
|
+

|
|
473
|
+
_Using datapills in regex expressions_
|
|
474
|
+
|
|
475
|
+
**Note:** All regex metacharacters will need to be escaped if they should not be interpreted as metacharacters.
|
|
476
|
+
:::
|
|
477
|
+
|
|
478
|
+
::: details Example of chaining where conditions
|
|
479
|
+
If a series of WHERE conditions are chained, the formula evaluates each where condition in series.
|
|
480
|
+
|
|
481
|
+
`contacts.where('state': 'CA').where('company_revenue >=': 10000)` returns the following rows, which is the same as the compound where formula:
|
|
482
|
+
|
|
483
|
+
| name | email | state | company | company_rev |
|
|
484
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
485
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
486
|
+
|
|
487
|
+
In this case, however, the chaining will result in an intermediary array:
|
|
488
|
+
|
|
489
|
+
`contacts.where('state': 'CA')` first returns:
|
|
490
|
+
|
|
491
|
+
| name | email | state | company | company_rev |
|
|
492
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
493
|
+
| Joe | joe@abc.om | CA | ABC | 1000 |
|
|
494
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
495
|
+
|
|
496
|
+
And `.where('company_revenue >=': 10000)` filters this intermediary array further to return only:
|
|
497
|
+
|
|
498
|
+
| name | email | state | company | company_rev |
|
|
499
|
+
| ---- | ------------ | ----- | ------- | ----------- |
|
|
500
|
+
| Jack | jack@hbo.com | CA | HBO | 30000 |
|
|
501
|
+
|
|
502
|
+
Results will be expressed as a list of hashes:
|
|
503
|
+
|
|
504
|
+
```ruby
|
|
505
|
+
[
|
|
506
|
+
{
|
|
507
|
+
'name' => 'Jack',
|
|
508
|
+
'email' => 'jack@hbo.com',
|
|
509
|
+
'state' => 'CA',
|
|
510
|
+
'company' => 'HBO',
|
|
511
|
+
'company_rev' => '30000'
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
```
|
|
515
|
+
:::
|
|
516
|
+
|
|
517
|
+
::: details Example of chaining not operator
|
|
518
|
+
You can use the WHERE formula to find the difference between two arrays by chaining a not operator. This is useful if you have two lists, an original list and an updated list, and plan to compare the two to ensure the updated list contains all values from the original list.
|
|
519
|
+
|
|
520
|
+
For example: `contacts.where.not("id":updated_contacts.pluck('id'))` identifies any values that are present in the original list (`contacts`) and missing from the updated list (`updated_contacts`).
|
|
521
|
+
:::
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
### `except`
|
|
526
|
+
|
|
527
|
+
Returns a hash that includes everything except given keys.
|
|
528
|
+
|
|
529
|
+
```ruby
|
|
530
|
+
hash = { a: true, b: false, c: nil }
|
|
531
|
+
hash.except(:c) # => { a: true, b: false }
|
|
532
|
+
hash.except(:a, :b) # => { c: nil }
|
|
533
|
+
hash # => { a: true, b: false, c: nil }
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
### `pluck`
|
|
539
|
+
|
|
540
|
+
Retrieves only the columns which have been specified.
|
|
541
|
+
|
|
542
|
+
#### Sample usage
|
|
543
|
+
|
|
544
|
+
::: details Example of a single column output
|
|
545
|
+
`contacts.pluck("email")` returns
|
|
546
|
+
|
|
547
|
+
| email |
|
|
548
|
+
| ------------ |
|
|
549
|
+
| joe@abc.com |
|
|
550
|
+
| jill@nbc.com |
|
|
551
|
+
| joan@nbc.com |
|
|
552
|
+
| jack@hbo.com |
|
|
553
|
+
|
|
554
|
+
If a single column, results will be returned as an array:
|
|
555
|
+
|
|
556
|
+
```ruby
|
|
557
|
+
["joe@abc.com", "jill@nbc.com", "joan@nbc.com", "jack@hbo.com"]
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
:::
|
|
561
|
+
|
|
562
|
+
::: details Example of a multiple column dataset
|
|
563
|
+
`contacts.where("state ==": "CA").pluck("email", "company")` returns
|
|
564
|
+
|
|
565
|
+
| email | company |
|
|
566
|
+
| ------------ | ------- |
|
|
567
|
+
| joe@abc.com | ABC |
|
|
568
|
+
| jill@nbc.com | NBC |
|
|
569
|
+
| joan@nbc.com | NBC |
|
|
570
|
+
| jack@hbo.com | HBO |
|
|
571
|
+
|
|
572
|
+
Results are returned as a list of a list:
|
|
573
|
+
|
|
574
|
+
```ruby
|
|
575
|
+
[["joe@abc.com", "ABC"], ["jill@nbc.com", "NBC"], ["joan@nbc.com", "NBC"], ["jack@hbo.com", "HBO"]]
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
:::
|
|
579
|
+
|
|
580
|
+
::: details Example of retrieving nested fields
|
|
581
|
+
This method can be used to extract nested fields. Use the `[<1st-level field>,<2nd-level field>...]` format to define which fields to retrieve.
|
|
582
|
+
|
|
583
|
+
`contacts.pluck("email", ["description", "summary"])` returns
|
|
584
|
+
|
|
585
|
+
| email | summary |
|
|
586
|
+
| ------------ | ------------------ |
|
|
587
|
+
| joe@abc.com | First time buyer |
|
|
588
|
+
| jill@nbc.com | Referral |
|
|
589
|
+
| joan@nbc.com | Recurring customer |
|
|
590
|
+
| jack@hbo.com | Recurring customer |
|
|
591
|
+
|
|
592
|
+
Results are returned as a list of lists:
|
|
593
|
+
|
|
594
|
+
```ruby
|
|
595
|
+
[
|
|
596
|
+
["joe@abc.com", "First time buyer"],
|
|
597
|
+
["jill@nbc.com", "Referral"],
|
|
598
|
+
["joan@nbc.com", "Recurring customer"],
|
|
599
|
+
["jack@hbo.com", "Recurring customer"]
|
|
600
|
+
]
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
:::
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
### `format_map`
|
|
608
|
+
|
|
609
|
+
Create an array of strings by formatting each row of given array of hashes. Allows you to add static text to the created strings as well. Fields to be represented in the format %{**\<field_name>**}.
|
|
610
|
+
|
|
611
|
+
#### Sample usage
|
|
612
|
+
|
|
613
|
+
`contacts.format_map('Name: %{name}, Email: %{email}, Company: %{company}') ` returns
|
|
614
|
+
|
|
615
|
+
```ruby
|
|
616
|
+
[
|
|
617
|
+
'Name: Joe, Email: joe@abc.com, Company: ABC' ,
|
|
618
|
+
'Name: Jill, Email: jill@nbc.com, Company: NBC' ,
|
|
619
|
+
'Name: Joan, Email: joan@nbc.com, Company: NBC' ,
|
|
620
|
+
'Name: Jack, Email: jack@hbo.com, Company: HBO' ,
|
|
621
|
+
]
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
The preceding example will give you a list of strings, one string for each row of the list **"contacts"**, using data from 3 of the fields: name, email, and company, as stated.
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
### `join`
|
|
629
|
+
|
|
630
|
+
Combines all items in a list into a text string. A separator is placed between each item.
|
|
631
|
+
|
|
632
|
+
#### Syntax
|
|
633
|
+
|
|
634
|
+
<kbd>List</kbd>.join(<span style="color:#FF0000">separator</span>)
|
|
635
|
+
|
|
636
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
637
|
+
- <span style="color:#FF0000">separator</span> - The character to add between items when they are joined. If no separator is specified, the list items will be joined together.
|
|
638
|
+
|
|
639
|
+
#### Sample usage
|
|
640
|
+
|
|
641
|
+
| Formula | Result |
|
|
642
|
+
| -------------------------------------------- | --------------- |
|
|
643
|
+
| <kbd>["Ms", "Jean", "Marie"]</kbd>.join("-") | "Ms-Jean-Marie" |
|
|
644
|
+
| <kbd>[1,2,3]</kbd>.join("--") | "1--2--3" |
|
|
645
|
+
| <kbd>["ab", "cd", "ef"]</kbd>.join | "abcdef" |
|
|
646
|
+
|
|
647
|
+
#### How it works
|
|
648
|
+
|
|
649
|
+
The list items are combined into a single text string. The separator characters is added between each item.
|
|
650
|
+
|
|
651
|
+
::: tip Separator character
|
|
652
|
+
You can use a string of characters together as the separator argument (for example, `", "`).
|
|
653
|
+
|
|
654
|
+
<kbd>["Open","Pending","Closed"]</kbd>.join(", ") returns `"Open, Pending, Closed"`.
|
|
655
|
+
:::
|
|
656
|
+
|
|
657
|
+
#### See also
|
|
658
|
+
|
|
659
|
+
- [split](/formulas/string-formulas.md#split): Divides a string around a specified character and returns an array of strings.
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
### `smart_join`
|
|
664
|
+
|
|
665
|
+
Joins list elements into a string. Removes empty and nil values and trims any white space before joining.
|
|
666
|
+
|
|
667
|
+
#### Syntax
|
|
668
|
+
|
|
669
|
+
<kbd>List</kbd>.smart_join(<span style="color:#FF0000">separator</span>)
|
|
670
|
+
|
|
671
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
672
|
+
- <span style="color:#FF0000">separator</span> - The character to add between items when they are joined. If no separator is specified, a blank space will be used as the joining character.
|
|
673
|
+
|
|
674
|
+
#### Sample usage
|
|
675
|
+
|
|
676
|
+
| Formula | Result |
|
|
677
|
+
| ------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
678
|
+
| <kbd>[nil, "", "Hello", " ", "World"]</kbd>.smart_join(" ") | "Hello World" |
|
|
679
|
+
| <kbd>["111 Vinewood Drive", "", "San Francisco", "CA", "95050"]</kbd>.smart_join(",") | "111 Vinewood Drive, San Francisco, CA, 95050" |
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
### `concat`
|
|
684
|
+
|
|
685
|
+
Concatenates 2 lists into a single list. Nested lists will NOT be flattened.
|
|
686
|
+
|
|
687
|
+
#### Syntax
|
|
688
|
+
|
|
689
|
+
<kbd>List</kbd>.concat(<span style="color:#FF0000">list_to_be_joined</span>)
|
|
690
|
+
|
|
691
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
692
|
+
- <span style="color:#FF0000">list_to_be_joined</span> - The other list to be concatenated with the original list input.
|
|
693
|
+
|
|
694
|
+
#### Sample usage
|
|
695
|
+
|
|
696
|
+
| Formula | Result |
|
|
697
|
+
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
698
|
+
| <kbd>["Hello", "World"]</kbd>.concat(<kbd>["Workato", "Rocks"]</kbd>) | <kbd>["Hello", "World", "Workato", "Rocks"]</kbd> |
|
|
699
|
+
| <kbd>["Hello", "World", ["Sub-array", "Here"]]</kbd>.concat(<kbd>["Workato", "Rocks"]</kbd>) | <kbd>["Hello", "World", ["Sub-array", "Here"], "Workato", "Rocks"]</kbd> |
|
|
700
|
+
| <kbd>["Hello", "World", nil, ["Sub-array", "Here"]]</kbd>.concat(<kbd>["Workato", "Rocks"]</kbd>) | <kbd>["Hello", "World", nil, ["Sub-array", "Here"], "Workato", "Rocks"]</kbd> |
|
|
701
|
+
|
|
702
|
+
---
|
|
703
|
+
|
|
704
|
+
### `reverse`
|
|
705
|
+
|
|
706
|
+
Reverses the order of a list.
|
|
707
|
+
|
|
708
|
+
#### Syntax
|
|
709
|
+
|
|
710
|
+
<kbd>List</kbd>.reverse
|
|
711
|
+
|
|
712
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
713
|
+
|
|
714
|
+
#### Sample usage
|
|
715
|
+
|
|
716
|
+
| Formula | Result |
|
|
717
|
+
| -------------------------------------------------- | ------------------------------- |
|
|
718
|
+
| <kbd>["Joe", "Jill", "Joan", "Jack"]</kbd>.reverse | ["Jack", "Joan", "Jill", "Joe"] |
|
|
719
|
+
| <kbd>[100, 101, 102, 103]</kbd>.reverse | [103, 102, 101, 100] |
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
### `sum`
|
|
724
|
+
|
|
725
|
+
For integers and decimals, the numbers will be added together and the total sum obtained. For strings, the strings will be concatenated together to form a longer string.
|
|
726
|
+
|
|
727
|
+
#### Syntax
|
|
728
|
+
|
|
729
|
+
<kbd>List</kbd>.sum
|
|
730
|
+
|
|
731
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
732
|
+
|
|
733
|
+
#### Sample usage
|
|
734
|
+
|
|
735
|
+
| Formula | Result |
|
|
736
|
+
| ----------------------------- | -------- |
|
|
737
|
+
| <kbd>[1, 2, 3]</kbd>.sum | 6 |
|
|
738
|
+
| <kbd>[1.5, 2.5, 3]</kbd>.sum | 7.0 |
|
|
739
|
+
| <kbd>["abc", "xyz"]</kbd>.sum | "abcxyz" |
|
|
740
|
+
|
|
741
|
+
---
|
|
742
|
+
|
|
743
|
+
### `uniq`
|
|
744
|
+
|
|
745
|
+
Returns a list containing unique items.
|
|
746
|
+
|
|
747
|
+
#### Syntax
|
|
748
|
+
|
|
749
|
+
<kbd>List</kbd>.uniq
|
|
750
|
+
|
|
751
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
752
|
+
|
|
753
|
+
#### Sample usage
|
|
754
|
+
|
|
755
|
+
| Formula | Result |
|
|
756
|
+
| ------------------------------------------------------ | ---------------------- |
|
|
757
|
+
| <kbd>["joe", "jack", "jill", "joe", "jack"]</kbd>.uniq | ["joe","jack", "jill"] |
|
|
758
|
+
| <kbd>[1, 2, 3, 1, 1, 3]</kbd>.uniq | [1, 2, 3] |
|
|
759
|
+
| <kbd>[1.0, 1.5, 1.0]</kbd>.uniq | [1.0, 1.5] |
|
|
760
|
+
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
### `flatten`
|
|
764
|
+
|
|
765
|
+
Flattens a multi-dimensional array (i.e. array of arrays) to a single dimension array.
|
|
766
|
+
|
|
767
|
+
#### Syntax
|
|
768
|
+
|
|
769
|
+
<kbd>List</kbd>.flatten
|
|
770
|
+
|
|
771
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
772
|
+
|
|
773
|
+
#### Sample usage
|
|
774
|
+
|
|
775
|
+
| Formula | Result |
|
|
776
|
+
| ---------------------------------------------- | --------------------- |
|
|
777
|
+
| <kbd>[[1, 2, 3], [4, 5, 6]]</kbd>.flatten | [1, 2, 3, 4, 5, 6] |
|
|
778
|
+
| <kbd>[[1, [2, 3], 3], [4, 5, 6]]</kbd>.flatten | [1, 2, 3, 3, 4, 5, 6] |
|
|
779
|
+
| <kbd>[[1, [2, 3], 9], [9, 8, 7]]</kbd>.flatten | [1, 2, 3, 9, 9, 8, 7] |
|
|
780
|
+
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
### `length`
|
|
784
|
+
|
|
785
|
+
Returns the number of elements in self. Returns 0 if the list is empty.
|
|
786
|
+
|
|
787
|
+
#### Syntax
|
|
788
|
+
|
|
789
|
+
<kbd>List</kbd>.length
|
|
790
|
+
|
|
791
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
792
|
+
|
|
793
|
+
#### Sample usage
|
|
794
|
+
|
|
795
|
+
| Formula | Result |
|
|
796
|
+
| ------------------------------------- | ------ |
|
|
797
|
+
| <kbd>[ 1, 2, 3, 4, 5 ]</kbd>.length | 5 |
|
|
798
|
+
| <kbd>[{..}, {..}, {..}]</kbd>.length | 3 |
|
|
799
|
+
| <kbd>[" ", nil, "", nil]</kbd>.length | 4 |
|
|
800
|
+
| <kbd>[]</kbd>.length | 0 |
|
|
801
|
+
|
|
802
|
+
---
|
|
803
|
+
|
|
804
|
+
### `max`
|
|
805
|
+
|
|
806
|
+
Returns largest value in an array. When comparing numbers, the largest number is returned. When comparing strings, the string with the largest ASCII value is returned.
|
|
807
|
+
|
|
808
|
+
#### Syntax
|
|
809
|
+
|
|
810
|
+
<kbd>List</kbd>.max
|
|
811
|
+
|
|
812
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
813
|
+
|
|
814
|
+
#### Sample usage
|
|
815
|
+
|
|
816
|
+
| Formula | Result |
|
|
817
|
+
| ------------------------------------- | ------ |
|
|
818
|
+
| <kbd>[-5, 0, 1, 2, 3, 4, 5]</kbd>.max | 5 |
|
|
819
|
+
| <kbd>[-1.5, 1.5, 2, 3, 3.5]</kbd>.max | 3.5 |
|
|
820
|
+
| <kbd>["cat", "dog", "rat"]</kbd>.max | "rat" |
|
|
821
|
+
|
|
822
|
+
---
|
|
823
|
+
|
|
824
|
+
### `min`
|
|
825
|
+
|
|
826
|
+
Returns smallest value in an array. When comparing numbers, the smallest number is returned. When comparing strings, the string with the smallest ASCII value is returned.
|
|
827
|
+
|
|
828
|
+
#### Syntax
|
|
829
|
+
|
|
830
|
+
<kbd>List</kbd>.min
|
|
831
|
+
|
|
832
|
+
- <kbd>List</kbd> - An input of list datatype.
|
|
833
|
+
|
|
834
|
+
#### Sample usage
|
|
835
|
+
|
|
836
|
+
| Formula | Result |
|
|
837
|
+
| ------------------------------------- | ------ |
|
|
838
|
+
| <kbd>[-5, 0, 1, 2, 3, 4, 5]</kbd>.min | -5 |
|
|
839
|
+
| <kbd>[-1.5, 1.5, 2, 3, 3.5]</kbd>.min | -1.5 |
|
|
840
|
+
| <kbd>["cat", "dog", "rat"]</kbd>.min | "cat" |
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
### `compact`
|
|
845
|
+
|
|
846
|
+
Removes nil values from array and hash.
|
|
847
|
+
|
|
848
|
+
#### Sample usage
|
|
849
|
+
|
|
850
|
+
| Formula | Result |
|
|
851
|
+
| ----------------------------------------------- | ------------------ |
|
|
852
|
+
| <kbd>["foo", nil, "bar"]</kbd>.compact | ["foo", "bar"] |
|
|
853
|
+
| <kbd>{ foo: 1, bar: nil, baz: 2 }</kbd>.compact | { foo: 1, baz: 2 } |
|
|
854
|
+
|
|
855
|
+
---
|
|
856
|
+
|
|
857
|
+
## Conditionals
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
### `blank?`
|
|
862
|
+
|
|
863
|
+
This formula checks the input string and returns true if it is an empty string or if it is null.
|
|
864
|
+
|
|
865
|
+
#### Syntax
|
|
866
|
+
|
|
867
|
+
<kbd>Input</kbd>.blank?
|
|
868
|
+
|
|
869
|
+
- <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or datetime datatype.
|
|
870
|
+
|
|
871
|
+
#### Sample usage
|
|
872
|
+
|
|
873
|
+
| Formula | Result |
|
|
874
|
+
| ----------------------------- | ------ |
|
|
875
|
+
| <kbd>"Any Value"</kbd>.blank? | false |
|
|
876
|
+
| <kbd>123</kbd>.blank? | false |
|
|
877
|
+
| <kbd>0</kbd>.blank? | false |
|
|
878
|
+
| <kbd>""</kbd>.blank? | true |
|
|
879
|
+
|
|
880
|
+
#### How it works
|
|
881
|
+
|
|
882
|
+
If the input is null or an empty string, the formula will return true. For any other data, it returns false.
|
|
883
|
+
|
|
884
|
+
#### See also
|
|
885
|
+
|
|
886
|
+
- [presence](/formulas/string-formulas.md#presence): Returns the data if it exists, returns nil if it does not.
|
|
887
|
+
- [present?](/formulas/string-formulas.md#present): Returns true if there is a valid input.
|
|
888
|
+
|
|
889
|
+
---
|
|
890
|
+
|
|
891
|
+
### `include?`
|
|
892
|
+
|
|
893
|
+
Checks if the string contains a specific substring, or if a list contains an element. Returns true if it does.
|
|
894
|
+
|
|
895
|
+
#### Syntax
|
|
896
|
+
|
|
897
|
+
<kbd>Input</kbd>.include?(<span style="color:#FF0000">substring</span>)
|
|
898
|
+
|
|
899
|
+
- <kbd>Input</kbd> - A string or list input.
|
|
900
|
+
- <span style="color:#FF0000">substring_or_element</span> - The substring or element to check for.
|
|
901
|
+
|
|
902
|
+
#### Sample usage
|
|
903
|
+
|
|
904
|
+
| Formula | Result |
|
|
905
|
+
| ---------------------------------------------------------------------------------------------- | ------ |
|
|
906
|
+
| <kbd>"Partner account"</kbd>.include?("Partner") | true |
|
|
907
|
+
| <kbd>"Partner account"</kbd>.include?("partner") | false |
|
|
908
|
+
| <kbd>["Hello", "World", ["Sub-array","Here"]"]</kbd>.include?("Hello") | true |
|
|
909
|
+
| <kbd>["Hello", "World", ["Sub-array","Here"]"]</kbd>.include?(<kbd>["Sub-array","Here"]</kbd>) | true |
|
|
910
|
+
|
|
911
|
+
#### How it works
|
|
912
|
+
|
|
913
|
+
This formula check is the string contains a specific substring, or if a list contains a specific element. Returns true if it does, otherwise, returns false. The substring comparison is case sensitive, and the element comparison is exact match.
|
|
914
|
+
|
|
915
|
+
This function acts in an opposite manner from [exclude?](#exclude). The latter will return true only if the input string/list does NOT contain the stated keyword/element.
|
|
916
|
+
|
|
917
|
+
#### See also
|
|
918
|
+
|
|
919
|
+
- [exclude?](#exclude): Checks if the string contains a specific substring, or if a list contains an element. Returns false if it does.
|
|
920
|
+
|
|
921
|
+
---
|
|
922
|
+
|
|
923
|
+
### `exclude?`
|
|
924
|
+
|
|
925
|
+
Checks if the string contains a specific substring, or if a list contains an element. Returns false if it does.
|
|
926
|
+
|
|
927
|
+
#### Syntax
|
|
928
|
+
|
|
929
|
+
<kbd>Input</kbd>.exclude?(<span style="color:#FF0000">substring</span>)
|
|
930
|
+
|
|
931
|
+
- <kbd>Input</kbd> - A string or list input.
|
|
932
|
+
- <span style="color:#FF0000">substring_or_element</span> - The substring or element to check for.
|
|
933
|
+
|
|
934
|
+
#### Sample usage
|
|
935
|
+
|
|
936
|
+
| Formula | Result |
|
|
937
|
+
| ---------------------------------------------------------------------------------------------- | ------ |
|
|
938
|
+
| <kbd>"Partner account"</kbd>.exclude?("Partner") | false |
|
|
939
|
+
| <kbd>"Partner account"</kbd>.exclude?("partner") | true |
|
|
940
|
+
| <kbd>["Hello", "World", ["Sub-array","Here"]"]</kbd>.include?("Hello") | false |
|
|
941
|
+
| <kbd>["Hello", "World", ["Sub-array","Here"]"]</kbd>.include?(<kbd>["Sub-array","Here"]</kbd>) | false |
|
|
942
|
+
|
|
943
|
+
#### How it works
|
|
944
|
+
|
|
945
|
+
This formula check is the string contains a specific substring, or if a list contains a specific element. Returns false if it does, otherwise, returns true. The substring comparison is case sensitive, and the element comparison is exact match.
|
|
946
|
+
|
|
947
|
+
This function acts in an opposite manner from [include?](#include). The latter will return true only if the input string/list contains the stated keyword/element.
|
|
948
|
+
|
|
949
|
+
#### See also
|
|
950
|
+
|
|
951
|
+
- [include?](#include): Checks if the string contains a specific substring, or if a list contains an element. Returns true if it does.
|
|
952
|
+
|
|
953
|
+
---
|
|
954
|
+
|
|
955
|
+
### `present?`
|
|
956
|
+
|
|
957
|
+
This formula will check the input and if there is a value present, it will return true. If the input is nil, boolean false, an empty string, or an empty list, the formula will return false.
|
|
958
|
+
|
|
959
|
+
#### Syntax
|
|
960
|
+
|
|
961
|
+
<kbd>Input</kbd>.present?
|
|
962
|
+
|
|
963
|
+
- <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or list datatype.
|
|
964
|
+
|
|
965
|
+
#### Sample usage
|
|
966
|
+
|
|
967
|
+
| Formula | Result |
|
|
968
|
+
| ------------------------------------------------------ | ------ |
|
|
969
|
+
| <kbd>"Any Value"</kbd>.present? | true |
|
|
970
|
+
| <kbd>123</kbd>.present? | true |
|
|
971
|
+
| <kbd>0</kbd>.present? | true |
|
|
972
|
+
| <kbd>"2017-04-02T12:30:00.000000-07:00"</kbd>.present? | true |
|
|
973
|
+
| <kbd>nil</kbd>.present? | false |
|
|
974
|
+
| <kbd>""</kbd>.present? | false |
|
|
975
|
+
| <kbd>[]</kbd>.present? | false |
|
|
976
|
+
|
|
977
|
+
#### How it works
|
|
978
|
+
|
|
979
|
+
If the input is null, an empty string or an empty list, the formula will return false. For any other data, it returns true.
|
|
980
|
+
|
|
981
|
+
::: tip Evaluating a list with nil values
|
|
982
|
+
|
|
983
|
+
- Only an empty list will return false.
|
|
984
|
+
|
|
985
|
+
<kbd>[]</kbd>.present? returns false.
|
|
986
|
+
|
|
987
|
+
- A list with nil and empty string will return true.
|
|
988
|
+
|
|
989
|
+
<kbd>[nil,""]</kbd>.present? returns true.
|
|
990
|
+
:::
|
|
991
|
+
|
|
992
|
+
#### See also
|
|
993
|
+
|
|
994
|
+
- [presence](/formulas/array-list-formulas.md#presence): Returns the data if it exists, returns nil if it does not.
|
|
995
|
+
- [blank?](/formulas/array-list-formulas.md#blank): Returns nil if the data does not exist or if the string consist of only white spaces.
|
|
996
|
+
|
|
997
|
+
---
|
|
998
|
+
|
|
999
|
+
### `presence`
|
|
1000
|
+
|
|
1001
|
+
Returns the data if it exists, returns nil if it does not.
|
|
1002
|
+
|
|
1003
|
+
#### Syntax
|
|
1004
|
+
|
|
1005
|
+
<kbd>Input</kbd>.presence
|
|
1006
|
+
|
|
1007
|
+
- <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or datetime datatype.
|
|
1008
|
+
|
|
1009
|
+
#### Sample usage
|
|
1010
|
+
|
|
1011
|
+
| Formula | Result |
|
|
1012
|
+
| ------------------------------- | ----------- |
|
|
1013
|
+
| <kbd>nil</kbd>.presence | nil |
|
|
1014
|
+
| <kbd>""</kbd>.presence | nil |
|
|
1015
|
+
| <kbd>"Any Value"</kbd>.presence | "Any Value" |
|
|
1016
|
+
| <kbd>45.0</kbd>.presence | 45.0 |
|
|
1017
|
+
| <kbd>0</kbd>.presence | 0 |
|
|
1018
|
+
|
|
1019
|
+
#### How it works
|
|
1020
|
+
|
|
1021
|
+
If the input is null or an empty string, the formula will return nil. For any other data, it returns the original input data.
|
|
1022
|
+
|
|
1023
|
+
#### See also
|
|
1024
|
+
|
|
1025
|
+
- [blank?](/formulas/array-list-formulas.md#blank): Returns nil if the data does not exist or if the string consist of only white spaces.
|
|
1026
|
+
- [present?](/formulas/array-list-formulas.md#present): Returns true if there is a valid input.
|
|
1027
|
+
|
|
1028
|
+
---
|
|
1029
|
+
|
|
1030
|
+
## Conversion
|
|
1031
|
+
|
|
1032
|
+
---
|
|
1033
|
+
|
|
1034
|
+
The following formulas allows you to convert data from arrays to other data types
|
|
1035
|
+
|
|
1036
|
+
---
|
|
1037
|
+
|
|
1038
|
+
### `to_csv`
|
|
1039
|
+
|
|
1040
|
+
Generates CSV line from an array. This handles escaping. Nil values and empty strings will also be expressed within the csv line.
|
|
1041
|
+
|
|
1042
|
+
#### Syntax
|
|
1043
|
+
|
|
1044
|
+
<kbd>Input</kbd>.to_csv
|
|
1045
|
+
|
|
1046
|
+
- <kbd>Input</kbd> - An input of list datatype.
|
|
1047
|
+
|
|
1048
|
+
#### Sample usage
|
|
1049
|
+
|
|
1050
|
+
| Formula | Result |
|
|
1051
|
+
| ------------------------------------------------------------------ | --------------------------------- |
|
|
1052
|
+
| <kbd>["John Smith", "No-Email", " ", nil, "555-1212"]</kbd>.to_csv | "John Smith,No-Email, ,,555-1212" |
|
|
1053
|
+
| <kbd>["John Smith", "No-Email", " ", nil, 1212]</kbd>.to_csv | "John Smith,No-Email, ,,1212" |
|
|
1054
|
+
|
|
1055
|
+
---
|
|
1056
|
+
|
|
1057
|
+
### `to_json`
|
|
1058
|
+
|
|
1059
|
+
Converts hash or array to JSON string.
|
|
1060
|
+
|
|
1061
|
+
#### Syntax
|
|
1062
|
+
|
|
1063
|
+
<kbd>Input</kbd>.to_json
|
|
1064
|
+
|
|
1065
|
+
- <kbd>Input</kbd> - An input datapill. It can be a list or hash datatype.
|
|
1066
|
+
|
|
1067
|
+
#### Sample usage
|
|
1068
|
+
|
|
1069
|
+
| Formula | Result |
|
|
1070
|
+
| ------------------------------------------------------ | ---------------------------- |
|
|
1071
|
+
| <kbd>{"pet" => "cat", "color" => "gray"}</kbd>.to_json | {"pet":"cat","color":"gray"} |
|
|
1072
|
+
| <kbd>["1","2","3"]</kbd>.to_json | ["1", "2", "3"] |
|
|
1073
|
+
|
|
1074
|
+
---
|
|
1075
|
+
|
|
1076
|
+
### `to_xml`
|
|
1077
|
+
|
|
1078
|
+
Converts hash or array into XML string.
|
|
1079
|
+
|
|
1080
|
+
#### Syntax
|
|
1081
|
+
|
|
1082
|
+
<kbd>Input</kbd>.to_xml
|
|
1083
|
+
|
|
1084
|
+
- <kbd>Input</kbd> - An input datapill. It can be a list or hash datatype.
|
|
1085
|
+
|
|
1086
|
+
#### Sample usage
|
|
1087
|
+
|
|
1088
|
+
| Formula | Result |
|
|
1089
|
+
| ---------------------------------------------------- | -------------------------------------------------- |
|
|
1090
|
+
| <kbd>{"name" => "Ken"}</kbd>.to_xml(root: "user") | \<user>\<name>Ken\</name>\</user> |
|
|
1091
|
+
| <kbd>[{"name" => "Ken"}]</kbd>.to_xml(root: "users") | \<users>\<user>\<name>Ken\</name>\</user>\</users> |
|
|
1092
|
+
|
|
1093
|
+
---
|
|
1094
|
+
|
|
1095
|
+
### `from_xml`
|
|
1096
|
+
|
|
1097
|
+
Converts XML string to hash.
|
|
1098
|
+
|
|
1099
|
+
#### Syntax
|
|
1100
|
+
|
|
1101
|
+
<kbd>Input</kbd>.from_xml
|
|
1102
|
+
|
|
1103
|
+
- <kbd>Input</kbd> - Input XML data.
|
|
1104
|
+
|
|
1105
|
+
#### Sample usage
|
|
1106
|
+
|
|
1107
|
+
::: details Converting XML string to hash
|
|
1108
|
+
|
|
1109
|
+
This XML string:
|
|
1110
|
+
|
|
1111
|
+
`<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <hash><foo type="integer">123</foo></hash>`
|
|
1112
|
+
|
|
1113
|
+
represents the following XML data.
|
|
1114
|
+
|
|
1115
|
+
```xml
|
|
1116
|
+
<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
|
|
1117
|
+
|
|
1118
|
+
<hash>
|
|
1119
|
+
<foo type="integer">123</foo>
|
|
1120
|
+
</hash>
|
|
1121
|
+
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
<kbd>XML string</kbd>.from_xml will return the following hash.
|
|
1125
|
+
|
|
1126
|
+
```ruby
|
|
1127
|
+
{ "hash":
|
|
1128
|
+
[ "foo":
|
|
1129
|
+
[
|
|
1130
|
+
{ "@type": "integer",
|
|
1131
|
+
"content!": "1"
|
|
1132
|
+
}
|
|
1133
|
+
]
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
:::
|
|
1139
|
+
|
|
1140
|
+
---
|
|
1141
|
+
|
|
1142
|
+
### `encode_www_form`
|
|
1143
|
+
|
|
1144
|
+
Join hash into url-encoded string of parameters.
|
|
1145
|
+
|
|
1146
|
+
#### Syntax
|
|
1147
|
+
|
|
1148
|
+
<kbd>Input</kbd>.encode_www_form
|
|
1149
|
+
|
|
1150
|
+
- <kbd>Input</kbd> - An input of hash datatype.
|
|
1151
|
+
|
|
1152
|
+
#### Sample usage
|
|
1153
|
+
|
|
1154
|
+
| Formula | Result |
|
|
1155
|
+
| --------------------------------------------------------------- | --------------------- |
|
|
1156
|
+
| <kbd>{"apple" => "red green", "2" => "3"}</kbd>.encode_www_form | "apple=red+green&2=3" |
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
### `to_param`
|
|
1161
|
+
|
|
1162
|
+
Returns a string representation for use as a URL query string.
|
|
1163
|
+
|
|
1164
|
+
#### Syntax
|
|
1165
|
+
|
|
1166
|
+
<kbd>Input</kbd>.to_param
|
|
1167
|
+
|
|
1168
|
+
- <kbd>Input</kbd> - An input of hash datatype.
|
|
1169
|
+
|
|
1170
|
+
#### Sample usage
|
|
1171
|
+
|
|
1172
|
+
| Formula | Result |
|
|
1173
|
+
| --------------------------------------------- | ------------------ |
|
|
1174
|
+
| <kbd>{name: 'Jake', age: '22'}</kbd>.to_param | "name=Jake&age=22" |
|
|
1175
|
+
|
|
1176
|
+
---
|
|
1177
|
+
|
|
1178
|
+
### `keys`
|
|
1179
|
+
|
|
1180
|
+
Returns an array of keys from the input hash.
|
|
1181
|
+
|
|
1182
|
+
#### Syntax
|
|
1183
|
+
|
|
1184
|
+
<kbd>Input</kbd>.keys
|
|
1185
|
+
|
|
1186
|
+
- <kbd>Input</kbd> - An input of hash datatype.
|
|
1187
|
+
|
|
1188
|
+
#### Sample usage
|
|
1189
|
+
|
|
1190
|
+
| Formula | Result |
|
|
1191
|
+
| ------------------------------------------------- | --------------- |
|
|
1192
|
+
| <kbd>{"name" => 'Jake', "age" => '22'}</kbd>.keys | ["name", "age"] |
|
|
1193
|
+
|
|
1194
|
+
---
|
|
1195
|
+
|
|
1196
|
+
### `values`
|
|
1197
|
+
|
|
1198
|
+
Returns an array of values from the input hash.
|
|
1199
|
+
|
|
1200
|
+
#### Syntax
|
|
1201
|
+
|
|
1202
|
+
<kbd>Input</kbd>.values
|
|
1203
|
+
|
|
1204
|
+
- <kbd>Input</kbd> - An input of hash datatype.
|
|
1205
|
+
|
|
1206
|
+
#### Sample usage
|
|
1207
|
+
|
|
1208
|
+
| Formula | Result |
|
|
1209
|
+
| ------------------------------------------------- | --------------- |
|
|
1210
|
+
| <kbd>{"name" => 'Jake', "age" => '22'}</kbd>.values | ["Jake", "22"] |
|
|
1211
|
+
|
|
1212
|
+
---
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
## List operands
|
|
1216
|
+
|
|
1217
|
+
### Difference (`-`)
|
|
1218
|
+
|
|
1219
|
+
Returns the difference between two arrays, meaning a new array that is a copy of the first array without any of the items also present in the second array.
|
|
1220
|
+
|
|
1221
|
+
#### Syntax
|
|
1222
|
+
|
|
1223
|
+
`list` - `updated_list`
|
|
1224
|
+
|
|
1225
|
+
- `-` the difference/subtract operand
|
|
1226
|
+
- `list` - the original list
|
|
1227
|
+
- `updated_list` - an updated list
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
#### Sample usage
|
|
1231
|
+
|
|
1232
|
+
Let's say you have two arrays, `contacts` and `updated_contacts`:
|
|
1233
|
+
|
|
1234
|
+
`contacts = ["Ariel", "Max", "Kai", "Noam", "Tal"]`
|
|
1235
|
+
|
|
1236
|
+
`updated_contacts = ["Ariel", "Max", "Kai", "Lee", "Quinn"]`
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|Formula| Result |
|
|
1240
|
+
|-------|--------|
|
|
1241
|
+
| `contacts - updated_contacts` | ["Noam", "Tal"] |
|
|
1242
|
+
| `updated_contacts - contacts` | ["Lee", "Quinn"] |
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
#### How it works
|
|
1246
|
+
|
|
1247
|
+
This operand creates an array that is the difference between the two arrays. The first example, `contacts - updated_contacts`, returns an array of items present in `contacts` but not present in `updated_contacts`. It's important to note that this does not simply remove duplicate items; if we reverse the order of operations, we obtain different results. For example, when we find the difference between `updated_contacts` and `contacts`, the new array contains items that are present in `updated_contacts`, and not present in `contacts`.
|
|
1248
|
+
|
|
1249
|
+
#### See also
|
|
1250
|
+
|
|
1251
|
+
- [where](/formulas/array-list-formulas.md#where): Returns a subset of list items that meet a certain condition. Reference the example on chaining not operands to use `where` to compare two lists.
|
|
1252
|
+
|
|
1253
|
+
---
|
|
1254
|
+
|
|
1255
|
+
### Union (`&`)
|
|
1256
|
+
|
|
1257
|
+
While Workato does not support the union (`&`) operand to manipulate arrays directly, you can achieve a similar result by combining the [concat](#concat) and [uniq](#uniq) formulas.
|
|
1258
|
+
|
|
1259
|
+
#### Syntax
|
|
1260
|
+
|
|
1261
|
+
`list.concat(updated_list).uniq`
|
|
1262
|
+
|
|
1263
|
+
- `list` - a list
|
|
1264
|
+
- `concat` - concatenates two lists into a single list
|
|
1265
|
+
- `updated_list` - an updated list
|
|
1266
|
+
- `uniq` - returns a list containing unique values
|
|
1267
|
+
|
|
1268
|
+
#### Sample usage
|
|
1269
|
+
|
|
1270
|
+
| Formula | Result |
|
|
1271
|
+
|---------|--------|
|
|
1272
|
+
| `contacts.concat(updated_contacts).uniq` | ["Ariel", "Kai", "Lee", "Max", "Noam", "Quinn", "Tal"]
|
|
1273
|
+
|
|
1274
|
+
#### How it works
|
|
1275
|
+
|
|
1276
|
+
`concat` concatenates two lists into a single list, and `uniq` returns a list containing unique items. You can combine two lists and remove any duplicate items that may appear by combining the two formulas.
|