Extra Horizon
GitHub
  • Extra Horizon Documentation
  • Getting Started
    • Start familiarizing yourself
  • Tutorials
    • Medical Device Tutorial
      • Preparation
      • Build your first prototype
        • Define a data model
        • Configure your workflows
          • Workflow 1: Analyze a measurement
          • Workflow 2: Create & store a PDF report
          • Workflow 3: Send an e-mail
        • Define your permissions
          • Update your schema with user permissions
          • Update your schema with group permissions
        • Build the Front-End
          • Set up oAuth in your backend
          • Demo login page
      • Summary & Wrap up
    • Polysomnography (PSG) Tutorial
    • Retool - Building dashboards Tutorial
  • FAQ
    • General
  • Services
    • Identity and Access Management
      • User service
        • Users
        • Groups
        • Global roles
        • Configuration
      • Auth Service
        • Applications
        • OAuth2
        • OAuth1
        • MFA
        • OpenID Connect
          • Google Cloud
          • Azure ADFS
    • Data Management
      • File Service
      • Data Service
        • Schemas
        • Documents
        • FAQ Data Service
    • Automation
      • Task Service
        • Functions
        • Tasks
        • API Functions
        • Examples
          • Hello world (JS)
          • Hello world (Py)
          • Hello world (Docker)
        • FAQ
      • Dispatchers Service
      • Event Service
        • System Events
    • Communication
      • Notification Service
        • Notifications
        • Settings
      • Mail Service
    • Other
      • Localization Service
        • Language Codes
      • Template Service
        • Localizations
      • Payments Service
        • Subscriptions
        • Stripe
        • iOS App Store
      • Configurations Service
  • API Reference
    • OpenAPI Specifications
    • 📦Changelog
      • Per-service Changelog
    • Postman Reference Collection
  • Tools
    • SDK
    • CLI
    • Control Center
  • Additional Resources
    • Resource Query Language (RQL)
    • Handling Errors
    • GitHub
    • API interaction (Python)
    • Migration guide: Enabling verification request limiting
  • ExH Platform
    • 🙋Support
    • ⏱️Usage and Performance
    • 🔓Security
    • 🗺️Regions
    • ⚖️Cloud Subscription Agreement
    • 🇺🇸CFR 21 Part 11
Powered by GitBook
On this page
  • Schema Design
  • How can I validate that an array does not contain a certain value in a transition condition?
  • How can I validate that an array does contain a certain value in a transition condition?
  • Data Manipulation
  • How can I remove values from an array property in a record?
  • Permissions
  • What is the difference between creatorId and userIds in a document?

Was this helpful?

  1. Services
  2. Data Management
  3. Data Service

FAQ Data Service

Schema Design

How can I validate that an array does not contain a certain value in a transition condition?

If it is an array of strings, you can use regex expressions. In the following schema definition, you can find an example of a validation where the tag important_tag should not be present.

The relevant regex expression is ^(?!important_tag$).+$

{
    "name": "measurementSchema",
    "description": "Example Measurement Schema",
    "statuses": {
      "active": {}, 
      "deleted": {}
    },
    "creationTransition": {
      "type": "manual",
      "toStatus": "active"
    },
    "transitions": [
        {
            "name": "startRemoval",
            "type": "manual",
            "fromStatuses": [
                "active"
            ],
            "toStatus": "deleted",
            "conditions": [
                {
                    "type": "input",
                    "configuration": {
                        "type": "object",
                        "properties": {
                            "tags": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "pattern": "^(?!important_tag$).+$"
                                }
                            }
                        }
                    }
                }
            ]
        }
    ],
    "properties": {
        "tags": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}

How can I validate that an array does contain a certain value in a transition condition?

To validate that an array does contain a certain value there are different options. The following examples show how to check if an array contains the value important_tag.

Each code snippet shows the code in the condition configuration part of the schema.

Option 1 • Use a regex

{
  "type": "array",
  "items": {
    "type": "string"
  },
  "contains": {
    "type": "string",
    "pattern": "^important_tag$"
  }

Option 2 • Use the const keyword

{
  "type": "array",
  "items": {
    "type": "string"
  },
  "contains": {
    "type": "string",
    "const": "important_tag"
  }
}

Option 3 • Use the enum keyword

{
  "type": "array",
  "items": {
    "type": "string"
  },
  "contains": {
    "type": "string",
    "enum": ["important_tag"]
  }
}

Data Manipulation

How can I remove values from an array property in a record?

If the array items are objects, you can remove an object by executing the following HTTP call:

DELETE /data/v1/{{schemaIdOrName}}/documents/${documentId}/{{arrayName}}/{{objectId}}

If the array items are simple values, like strings or numbers, you have to execute a PUT to the record endpoint and provide the full array (leaving out the value that you want to remove).

Permissions

What is the difference between creatorId and userIds in a document?

PreviousDocumentsNextAutomation

Last updated 1 year ago

Was this helpful?

The creatorId refers to the user that created the document, userIds is an array of users which have access to the document as set by the . A simple use case is for example if you want to share a single document with multiple individual users which are not necessarily in the same group.

document permissions