### Example: Greeting with User Name (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content A simple example demonstrating how to greet a recipient using their username inserted via a Mustache reference. ```mustache Dear {{omni_user_name}}, ``` -------------------------------- ### Example: Slack Clickable Link (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content Specific example for Slack deliveries, creating a clickable link to a dashboard or workbook using Mustache references. ```mustache Review the <{{entityLink}}|{{entityName}}> report ``` -------------------------------- ### Example: Delivery Recipient Information (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content An example showing how to specify the delivery recipient's email address using a Mustache reference. ```mustache Report delivered to: {{recipientEmail}} ``` -------------------------------- ### Extend opp_line_item_daily_facts for Contract Start Metrics (YAML) Source: https://docs.omni.co/docs/modeling/topics/parameters Extends the 'opp_line_item_daily_facts' view to create a 'opp_line_item_start_facts' view. This new view customizes labels for 'drr_sum' and 'arr_sum' to 'Starting DRR' and 'Starting ARR' respectively, and defines a 'Starting ARR Sum' measure. This is useful for analyzing contract metrics at the inception of a contract. ```yaml views: opp_line_item_start_facts: extends: [ opp_line_item_daily_facts ] dimensions: drr_sum: label: Starting DRR arr_sum: label: Starting ARR measures: arr_sum_sum: sql: ${opp_line_item_start_facts.arr_sum} label: Starting ARR Sum aggregate_type: sum ``` -------------------------------- ### Example Cron Schedules Source: https://docs.omni.co/docs/sharing-and-sending/create-delivery Provides examples of cron expressions for scheduling automated deliveries in Omni. These examples demonstrate different frequencies and specific timings. ```text 0 9 ? * * * # At 9:00 AM every morning 30 6 L * ? * # At 6:30AM on the last day of the month 45 8 ? * MON-FRI * # At 8:45 AM every day, Monday through Friday ``` -------------------------------- ### Check Node.js and npm Installation Source: https://docs.omni.co/docs/ai/mcp/claude-desktop Verify if Node.js and npm are installed on your system by checking their versions. These are required for the `omni-co/mcp` package used in the MCP Server setup. ```bash node -v npm -v ``` -------------------------------- ### Example Omni Instance URL for MCP Server Source: https://docs.omni.co/docs/ai/mcp/vscode This is an example of how to format the Omni instance URL when configuring the MCP Server in VS Code. The '/mcp/https' path is crucial for establishing the correct connection type. ```text https://blobsrus.omniapp.co/mcp/https ``` -------------------------------- ### Date Interval Timeframe Examples Source: https://docs.omni.co/docs/querying-and-sql/querying Demonstrates how to use interval timeframes for advanced date filtering in Omni. It shows examples of specifying the starting point and duration for date ranges, covering scenarios like the first ten days of a year or a period starting from a past date. ```text # First ten days of 2023 [2023][10 days] # 100 days ago for 10 days [100 complete days ago][10 days] # 1 hour ago for 2000 milliseconds [1 hour ago][2000 milliseconds] ``` -------------------------------- ### List Connections (Basic Request) Source: https://docs.omni.co/docs/API/connections This example shows a basic GET request to retrieve a list of all database connections. It requires an authorization token in the header. The response is a JSON array of connection objects. ```curl curl -L 'https://blobsrus.omniapp.co/api/v1/connections' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' ``` -------------------------------- ### List Schedules with Full Text Search (curl) Source: https://docs.omni.co/docs/API/schedules Shows how to list schedules using a full-text search query parameter 'q'. The example searches for 'Blob Ross'. ```bash curl -L 'https://blobsrus.omniapp.co/api/v1/schedules?q=Blob%20Ross' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Example: Linking to Dashboard/Workbook (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content Shows how to create a clickable link to a dashboard or workbook using Mustache references for the entity name and link. ```mustache Review the {{entityName}} report here: {{entityLink}} ``` -------------------------------- ### List Schedules with Pagination (curl) Source: https://docs.omni.co/docs/API/schedules Shows how to implement cursor-based pagination for listing schedules. The example retrieves the second page with a page size of 10. ```bash curl -L 'https://blobsrus.omniapp.co/api/v1/schedules?cursor=2&pageSize=10' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Define Sample Queries for Topics Source: https://docs.omni.co/docs/modeling/model-files Provides a list of sample queries for topics, used to display example queries in workbooks and aid the AI query helper. Queries can be hidden or excluded from AI context using specific parameters. ```yaml sample_queries: Summary Stats: # query name query: fields: [ order_items.sale_price_sum, users.count, calc_1 ] base_view: order_items calculations: calc_1: sql: OMNI_FX_SAFE_DIVIDE(${order_items.sale_price_sum}, ${users.count}) limit: 1000 sorts: - field: order_items.sale_price_sum topic: order_items description: Total Revenue, Users and Revenue per User hidden: false prompt: show me total revenue, count of users and revenue per user ai_context: uses a calculation to compute avg. revenue per user exclude_from_ai_context: false ``` -------------------------------- ### Example `mcp.json` Initial State Source: https://docs.omni.co/docs/ai/mcp/vscode This shows the basic structure of the `mcp.json` file after initially adding an MCP server in VS Code. It typically contains the server name and its base URL. ```json { "servers": { "Omni": { "url": "https://YOUR-OMNI-INSTANCE/mcp/https" } } } ``` -------------------------------- ### Detailed JSON Response Example for 200 OK Status Source: https://docs.omni.co/docs/API/content-migration A comprehensive example of a 200 OK API response, detailing the nested structure of the dashboard object. This includes configurations for themes, filters, IDs, and query presentation collections, showcasing a specific 'Total Sales' query. ```json { "dashboard": { "dashboardCustomTheme": null, "facetFilters": false, "id": "18811d32-c6ef-48f5-ad86-d740d09b356c", "organizationId": "df290ed4-b721-4efe-914b-95d30ce1c5f2", "queryPresentationCollection": { "filterConfig": {}, "filterConfigVersion": 0, "filterOrder": [], "id": "028d3c99-57ba-4392-a96f-c063a8aa84df", "queryPresentationCollectionMemberships": [ { "queryPresentation": { "id": "f9467f90-b430-4381-b6b3-03436398421a", "createdAt": "2025-01-28T18:31:04.736Z", "updatedAt": "2025-01-28T18:31:04.736Z", "type": "query", "name": "Total Sales", "description": "", "organizationId": "df290ed4-b721-4efe-914b-95d30ce1c5f2", "queryId": "ee956bf5-cd5a-4d07-bb3b-6c4d54829b96", "miniUuid": "nY8mm3PM", "modelId": "7155f419-a071-405c-8426-b4b5d3939049", "prefersChart": true, "automaticVis": true, "visConfigId": "b1199b6c-5673-4b34-9ef6-552484e712b0", "topicName": "order_items", "viewName": null, "renamed": true, "filterOrder": [], "isSql": false, "resultConfig": {}, "query": { "id": "ee956bf5-cd5a-4d07-bb3b-6c4d54829b96", "createdAt": "2025-01-28T18:31:04.722Z", "jsonHash": "LBI8eliIlOJSszt2Hy8vb6lFP3rK9/zSQOJVY4vNBpg=", "modelId": "7155f419-a071-405c-8426-b4b5d3939049", "queryJson": { "limit": 1000, "sorts": [ { "column_name": "order_items.created_at[day_of_week_name]", "sort_descending": false } ], "table": "order_items", "fields": [ "order_items.created_at[day_of_week_name]", "order_items.sale_price_sum" ], "pivots": [], "dbtMode": false, "filters": { "order_items.delivered_at": { "kind": "TIME_FOR_INTERVAL_DURATION", "type": "date", "left_side": "6 months ago", "right_side": "6 months", "is_negative": false } }, "modelId": "7155f419-a071-405c-8426-b4b5d3939049", "version": 6, "controls": [ { "id": "nh7Rwbw0", "kind": "FIELD", "type": "FIELD_SELECTION", "field": "order_items.sale_price_sum", "options": [ { "label": "Sale Price Sum", "value": "order_items.sale_price_sum" } ] } ], "metadata": {}, "model_id": "0121b79b-3706-4d29-b2da-8e307e72dc78", "rewriteSql": true, "row_totals": {}, "fill_fields": [], "calculations": [], "column_limit": 50, "join_via_map": {}, "column_totals": {}, "userEditedSQL": "", "dimensionIndex": 1, "default_group_by": true, "query_references": {}, "custom_summary_types": {}, "join_paths_from_topic_name": "order_items" } }, "visConfig": { "id": "b1199b6c-5673-4b34-9ef6-552484e712b0", "createdAt": "2025-01-21T17:49:52.350Z", "visType": "omni-kpi", "chartType": "kpi", "jsonHash": "FEkaJm9fFbjYfgb+1ryb82FNf3VozU0eUqidVzybWf0=", "spec": { "alignment": "left", "fontKPISize": "", "fontBodySize": "", "fontLabelSize": "", "markdownConfig": [ { "id": "88570cff-0bba-42ff-9181-126b9dca5476", "type": "number", "config": { "field": { "row": "_first", "field": { "name": "order_items.sale_price_sum", "pivotMap": {} }, "label": { "field": { "name": "order_items.sale_price_sum", "pivotMap": {} }, "raw": "Sale Price Sum" } } } } ] } } } } ] }, "document": {}, "exportVersion": "0.1", "workbookModel": {} } } ``` -------------------------------- ### BigQuery Service Account JSON Key Example Source: https://docs.omni.co/docs/API/connections This is an example of a valid BigQuery service account JSON key file. It must be provided in the `passwordUnencrypted` field when creating a BigQuery connection. Ensure all fields are correctly populated with your service account's credentials. ```json { "type": "service_account", "project_id": "your-project-id", "private_key_id": "key-id", "private_key": "-----BEGIN PRIVATE KEY-----\nkey-content\n-----END PRIVATE KEY-----", "client_email": "service-account-email@your-project-id.iam.gserviceaccount.com", "client_id": "client-id", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account-email%40your-project-id.iam.gserviceaccount.com" } ``` -------------------------------- ### Mustache Tag Syntax Example Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text/mustache-reference Demonstrates the basic structure of a Mustache tag using a simple key for data retrieval. This is the fundamental syntax for all Mustache tags in Omni. ```mustache {{results}} ``` -------------------------------- ### Retrieve Folder Permissions (Example) Source: https://docs.omni.co/docs/API/folder-permissions This snippet shows how to retrieve the permissions for a specific user on a given folder. It uses a GET request with the `folderId` as a URL parameter and `userId` as a query parameter. The response details the permissions granted to the user. ```curl curl -L 'https://blobsrus.omniapp.co/api/v1/folders/21db26b3-466c-4791-90e7-b9ce9375426d/permissions?userId=f4df8d6e-7f69-4d54-b23b-7abfe5c4da74' \ -H 'Authentication: Bearer >' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Join opp_line_item_facts with Contract Start View (YAML) Source: https://docs.omni.co/docs/modeling/topics/parameters Defines a left outer join between 'opp_line_item_facts' and 'opp_line_item_start_facts'. This join is configured to match records based on opportunity ID and aligns the dates to ensure the data reflects the contract's start. It establishes a one-to-one relationship. ```yaml relationships: - join_from_view: opp_line_item_facts join_to_view: opp_line_item_start_facts join_type: always_left on_sql: ${salesforce__opportunity.id} = ${opp_line_item_start_facts.opp_id} AND ${opp_line_item_start_facts.date} = ${opp_line_item_facts.oli_first_date} relationship_type: one_to_one ``` -------------------------------- ### Dimensions Parameter Syntax and Example Source: https://docs.omni.co/docs/modeling/query-views Shows the syntax and an example for the 'dimensions' parameter in a query view. Dimensions are fields selected from the query that can be used for aggregation in other queries. ```yaml dimensions: : {} : {} : {} : {} ``` ```yaml dimensions: age: {} created_at_year: {} calc_1: {} ``` -------------------------------- ### CSS Box-Shadow Value Example Source: https://docs.omni.co/docs/visualization-and-dashboards/dashboards Provides an example of using CSS box-shadow values for theming the shadow properties of elements in Omni. This allows for customizable shadow effects. ```CSS /* Box shadow example */ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); ``` -------------------------------- ### SQL Server JDBC Connection String Example Source: https://docs.omni.co/docs/connections/database/microsoftsql Example of a JDBC connection string for a Microsoft SQL Server database. This string contains details like server address, port, database name, username, and security settings, which are essential for establishing a connection. ```sql jdbc:sqlserver://omni-test-admin.database.windows.net:1433; database=e-commerce; user=omni-test-admin@omni-test-admin; password={your_password_here}; encrypt=true; trustServerCertificate=false; hostNameInCertificate=*.database.windows.net; loginTimeout=30; ``` -------------------------------- ### Query Sub-parameter: base_view Syntax and Example Source: https://docs.omni.co/docs/modeling/query-views Demonstrates the syntax and an example of the 'base_view' sub-parameter within the 'query' parameter. 'base_view' specifies the primary view for the SQL FROM clause and is essential for building subsequent joins. ```yaml base_view: ``` ```yaml query: # The values in this map (e.g. created_at_year) are the aliases these get in the SQL. fields: users.age: age users.created_at[year]: created_at_year calc_1: calc_1 base_view: users ``` -------------------------------- ### Example: SFTP File Naming Convention (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content Illustrates a practical use case for Mustache references in defining a file naming convention for SFTP deliveries, incorporating the current date and entity name. ```mustache {{currentDate}}-{{entityName}} ``` -------------------------------- ### Example Query Definition in Omni-Co Source: https://docs.omni.co/docs/modeling/query-views This snippet demonstrates a basic query structure in Omni-Co, focusing on selecting fields and defining the base view. It also shows how to specify joins if needed. ```yaml query: # Top ten users by spend fields: users.id: id order_items.sale_price_sum: sales base_view: order_items join_via_map: orders: [] order_items: [ orders ] ``` -------------------------------- ### GET /scim/v2/groups Source: https://docs.omni.co/docs/API/user-groups Retrieves a list of all user groups, sorted by creation time. You can specify the number of results and the starting index. ```APIDOC ## GET /scim/v2/groups ### Description Retrieves a list of user groups, sorted by creation time. ### Method GET ### Endpoint /scim/v2/groups ### Parameters #### Query Parameters - **count** (integer) - Optional - The number of groups to return. Defaults to `100`. - **startIndex** (integer) - Optional - An integer index that determines the starting point of the sorted result list. Defaults to `1`. ### Response #### Success Response (200) - **Resources** (array of objects) - A list of user group objects. - **totalResults** (integer) - The total number of groups available. - **startIndex** (integer) - The starting index of the returned results. - **itemsPerPage** (integer) - The number of items returned per page. #### Response Example ```json { "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "totalResults": 1, "startIndex": 1, "itemsPerPage": 100, "Resources": [ { "displayName": "Blob SEs", "id": "mEhXj6ZI", "meta": { "created": "2024-12-04T00:08:03.250Z", "lastModified": "2024-12-04T00:20:47.346Z", "resourceType": "Group" }, "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "members": [ { "display": "iamagoodblob@blobsrus.co", "value": "9e8719d9-276a-4964-9395-a493189a247c" } ] } ] } ``` ``` -------------------------------- ### Retrieve Document Queries with cURL Source: https://docs.omni.co/docs/API/documents Example of how to retrieve queries associated with a document using the cURL command-line tool. This demonstrates the GET request to the /api/v1/documents/:identifier/queries endpoint, including necessary headers. ```bash curl -L 'https://blobsrus.omniapp.co/api/v1/documents/12db1a0a/queries' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Font Weight and Line Style Examples Source: https://docs.omni.co/docs/visualization-and-dashboards/dashboards Demonstrates the use of CSS number values for font weights and line style values for borders, as supported by Omni's theming capabilities. ```CSS /* Font weight example */ font-weight: 500; /* Border style example */ border-style: solid; ``` -------------------------------- ### Set Week Start Day Source: https://docs.omni.co/docs/modeling/model-files Defines the day that all weeks start on. Defaults to `Monday`. This setting impacts SQL operators like `OMNI_WEEK()` and `OMNI_DAY_OF_WEEK_NUMBER()`. ```lookml week_start_day: Sunday ``` -------------------------------- ### Provide AI Context Source: https://docs.omni.co/docs/modeling/topics/parameters Supplies free-form text to enhance the AI query helper's understanding and response generation. This context can include behavioral prompts and domain-specific information to guide AI interactions. ```yaml ai_context: | you are the head of finance. you are concerned with the status of customer payments. you often need to project into the future how many invoices are due and for how much. you also need to know if any invoices are late so you can reach out to those customers. ``` -------------------------------- ### Example SSO Embed URL for Omni Chat Source: https://docs.omni.co/docs/embed/external-embedding/ai-chat An example of a complete embed URL for Omni chat using standard SSO. This URL includes all necessary parameters for creating an embed session, such as connection roles, content path, external ID, mode, name, nonce, and signature. Ensure all parameters are correctly encoded and included for proper session initialization. ```url https://omni.blobsrus.com/embed/login?&connectionRoles=%7B%22c0f12353-4817-4398-bcc0-d501e6dd2f64%22%3A%22RESTRICTED_QUERIER%22%7D&contentPath=%2Fchat&externalId=Blobs+R+Us&mode=SINGLE_CONTENT&name=Blobby&nonce=yRt9RbPRST1pKP0fv4hkZkOcyydnwmWX&signature=prfIqNKkUBYlXiAdXLe_E__w19QbM_-6o3CIi4kkV1s ``` -------------------------------- ### Curate AI Topics with Specific Context Source: https://docs.omni.co/docs/ai/optimize-models This configuration provides detailed instructions and constraints for the AI when handling questions related to a specific topic, such as e-commerce orders. It guides the AI on data sources, field usage, and response limitations. ```yaml ai_context: |- This topic is focuses on e-commerce orders. The main concepts are orders at the line item level in the order items table, users in our user table, inventory in our inventory items table, and products in the products table. Only respond with accurate answers based on the data that you're aware of. Don't pivot unless there is more than one dimension included in the query. Typical questions will be focused on order performance over time, breakdowns across users, and more. - if asked about sales or performance, always use the order_items.total_sale_price field - if asked about which users or who, use the users.full_name and users.email fields. Never return an ID unless explicitly asked. - if asked about top n without a specific metric or dimension, assume it involves the order_items.total_sale_price and products.name fields ``` -------------------------------- ### Output Summaries in Multiple Languages Source: https://docs.omni.co/docs/ai/optimize-models Configure the AI to provide summaries in multiple languages by adding specific instructions to the 'ai_context'. This example demonstrates how to request summaries in both English and Spanish. ```yaml ai_context: | When generating a summary, always output the summary in both English and Spanish. ``` -------------------------------- ### GET /websites/omni_co/schedules Source: https://docs.omni.co/docs/API/schedules Fetches a list of schedules with configurable filtering, sorting, and pagination. ```APIDOC ## GET /websites/omni_co/schedules ### Description Retrieves a list of schedules. You can filter results by content type, destination, owner ID, schedule type, and status. Additionally, you can sort the results by various fields and control the pagination with cursor and page size. ### Method GET ### Endpoint `/websites/omni_co/schedules` ### Parameters #### Query Parameters - **contentType** (string) - Optional - Filter schedules by content type: `dashboard`, `single tile`. - **cursor** (number) - Optional - The page number for offset-based pagination. Defaults to 1. - **destination** (string) - Optional - Filter schedules by destination type: `email`, `slack`, `webhook`, `sftp`. - **ownerId** (string) - Optional - Filter schedules by the owner's user ID. - **pageSize** (number) - Optional - The number of results to include on each page. Accepted values are numbers `1` through `100`. Defaults to 20. - **q** (string) - Optional - Search term for filtering schedules by name, dashboard name, or owner name (case-insensitive). - **scheduleType** (string) - Optional - Filter by type: `alert`, `schedule`. - **sortDirection** (string) - Optional - The direction to sort results (`asc` or `desc`). Defaults to `desc`. - **sortField** (string) - Optional - The field to sort results by. Valid values are: `scheduleName`, `dashboardName`, `ownerName`, `lastRun`, `lastRunStatus`. Defaults to `scheduleName`. - **status** (string) - Optional - Filter schedules by delivery status: `success`, `error`, `canceled`, `none`. ### Request Example ``` GET /websites/omni_co/schedules?contentType=dashboard&destination=slack&sortField=lastRun&sortDirection=asc ``` ### Response #### Success Response (200) - **schedules** (array) - A list of schedule objects. - **id** (string) - The unique identifier of the schedule. - **name** (string) - The name of the schedule. - **ownerId** (string) - The ID of the schedule's owner. - **destination** (string) - The destination type for the schedule. - **contentType** (string) - The content type of the schedule. - **scheduleType** (string) - The type of the schedule. - **lastRunAt** (string) - The timestamp of the last run. - **lastRunStatus** (string) - The status of the last run. - **createdAt** (string) - The timestamp when the schedule was created. - **updatedAt** (string) - The timestamp when the schedule was last updated. #### Response Example ```json { "schedules": [ { "id": "sched_12345", "name": "Daily Sales Report", "ownerId": "user_abcde", "destination": "email", "contentType": "dashboard", "scheduleType": "schedule", "lastRunAt": "2023-10-27T10:00:00Z", "lastRunStatus": "success", "createdAt": "2023-10-26T09:00:00Z", "updatedAt": "2023-10-27T08:00:00Z" } ] } ``` ``` -------------------------------- ### 2-Step SSO Embed: Redeem Session Token and Redirect (GET Request) Source: https://docs.omni.co/docs/embed/external-embedding/setting-up-the-infrastructure This illustrates the second step of the 2-step SSO embed flow. After generating a session token in the first step, this GET request redeems that token and redirects the user to the specified content. This approach helps mitigate potential URL length limitations associated with standard SSO embeds. ```http GET /embed/login?sessionToken=&contentPath=%2Fembed%2Fdashboards%2F123abc&linkAccess=__omni_link_access_open HTTP/1.1 Host: .embed-omniapp.co ``` -------------------------------- ### Example: Report Generation Timestamp (Mustache) Source: https://docs.omni.co/docs/sharing-and-sending/dynamic-content Demonstrates how to include the generation date and time of a report using various Mustache date and time references. ```mustache This automated report was generated on {{currentMonth}}/{{currentDay}}/{{currentYear}} at {{currentTime}}. ``` -------------------------------- ### List User Groups API using cURL Source: https://docs.omni.co/docs/API/user-groups This snippet demonstrates how to retrieve a list of user groups from the Omni instance using the User Group API. It sends a GET request and allows for optional parameters to control the number of results and the starting index. The API adheres to the SCIM 2.0 standard. ```curl curl -L 'https://blobsrus.omniapp.co/api/scim/v2/groups' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Omni Query Field Examples Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text/mustache-reference These examples demonstrate how to retrieve metadata about specific query fields within Omni visualizations. They cover the display label of a view's field and the general label of a field. ```Markdown View name: `{{fields.view_name.field_name.view_label}}` Field name: `{{fields.view_name.field_name.label}}` ``` -------------------------------- ### Omni SQL Example with Custom Filters Source: https://docs.omni.co/docs/querying-and-sql/sql This example demonstrates how to write a SQL query in Omni using custom SQL filters with templated syntax. It allows dashboard filters to be linked to specific fields within the query, enabling dynamic filtering of data. The syntax `{{# filter_name_here }}` is used to represent filterable fields. ```sql SELECT * FROM order_items as items WHERE {{# order_items.created_at.filter }} items.created_at {{/ order_items.created_at.filter}} AND {{# order_items.status.filter }} items.status {{/ order_items.status.filter}} LIMIT 100 ``` -------------------------------- ### Omni Query Result Examples Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text/mustache-reference Examples for accessing query result values in Omni, including interactive, formatted (static), and raw values. It also shows how to retrieve specific data points like the first row, last row, specific row, column total, row total, and grand total. ```Markdown Interactive value: `{{result._first.view_name.field_name.value}}` Formatted value: `{{result._first.view_name.field_name.value_static}}` Raw value: `{{result._first.view_name.field_name.raw}}` First row value: `{{result._first.view_name.field_name.value_type}}` Last row value: `{{result._last.view_name.field_name.value_type}}` Specific row value: `{{result.row_number.view_name.field_name.value_type}}` Column total: `{{result._total.first.view_name.field_name.value_type}}` Row total (pivot): `{{result.row_number.row_total.view_name.field_name.value_type}}` Grand total: `{{result.totals._first.row_total.view_name.field_name.value_type}}` ``` -------------------------------- ### Validate Model API Request (cURL) Source: https://docs.omni.co/docs/API/model Example cURL command to validate a model using the GET /api/v1/models/:modelId/validate endpoint. Requires authentication with a Bearer token. ```bash curl -L 'https://blobsrus.omniapp.co/api/v1/models/123e4567-e89b-12d3-a456-426614174000/validate' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Measures Parameter Syntax and Example Source: https://docs.omni.co/docs/modeling/query-views Illustrates the syntax and an example for the 'measures' parameter. By default, it creates a COUNT(*) aggregation. Other aggregations are dimensionalized and listed under the 'dimensions' parameter. ```yaml measures: count: aggregation_type: count ``` ```yaml measures: count: aggregate_type: count ``` -------------------------------- ### Define Sample Queries and Field Metadata in IDE (LookML) Source: https://docs.omni.co/docs/ai/optimize-models This LookML snippet demonstrates how to define sample queries for a topic and add metadata to a field within a view. It shows the use of `sample_queries` for topics and `sample_values`, `synonyms`, and `ai_context` for fields, aiding AI understanding and user interaction. ```lookml view: products { dimensions: brand: sql: '"BRAND"' description: Brand name of product sample_values: [ Calvin Klein, Carhartt, Hanes, Volcom, Levi's, Diesel, Lucky Brand, Quicksilver, Nautica, American Apparel, Columbia, Hurley, Dockers, Arc'teryx, C-IN2, DKNY, HOBO, NOM, ANS ] synonyms: [ logo ] ai_context: To filter this field, use contains with the brand name. } topic: example_topic { # ... other topic configurations sample_queries: [ { label: "Example Query 1" description: "A sample query to demonstrate functionality." display_on_topic_overview: yes include_in_ai_context: yes prompt: "Show me products from a specific brand." ai_context: "This query helps find products by brand." } ] } model: example_model { # ... other model configurations sample_queries: [ { label: "Model Level Query 1" description: "A sample query for the entire model." display_on_topic_overview: yes include_in_ai_context: yes prompt: "Analyze sales data." ai_context: "This query analyzes overall sales." } ] } ``` -------------------------------- ### Display Opportunity Criteria Label with Tooltip (HTML) Source: https://docs.omni.co/docs/visualization-and-dashboards/visualization-types/markdown/examples/card-criteria-checklist Displays a criteria label for sales opportunities, such as 'Realistic Close Date Based On Stage'. It includes an information icon that reveals a tooltip with a detailed explanation of the criteria when hovered over. ```html
Realistic Close Date Based On Stage i This flags if the opportunity is in "Qualifying" with a close date within 14 days, in "Scoping" with a close date within 7 days, or in "Evaluating" with a close date within 3 days
``` -------------------------------- ### Omni User Attribute Element Examples Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text/mustache-reference Examples for retrieving specific elements of user attributes in Omni, such as their label, values, user email, name, ID, admin status, and group membership. Supported in dashboard Markdown tiles. ```Markdown Label / display name: `{{metadata.userAttributes.attribute_reference.label}}` Value(s): `{{metadata.userAttributes.attribute_reference.values}}` User email: `{{metadata.userAttributes.omni_user_email.element}}` User name: `{{metadata.userAttributes.omni_user_name.element}}` User ID: `{{metadata.userAttributes.omni_user_id.element}}` Is org admin?: `{{metadata.userAttributes.omni_is_org_admin.element}}` Custom user attribute: `{{metadata.userAttributes.custom_attribute_reference.element}}` User groups: `{{metadata.userAttributes.omni_user_groups.element}}` ``` -------------------------------- ### Example Field Metadata in Omni Source: https://docs.omni.co/docs/ai/optimize-models This snippet demonstrates the structure of basic field metadata within an Omni topic, including its SQL definition, label, and group label. This is a fundamental component of the information provided as context to the AI. ```yaml active_camp_active_campaign_id_c: sql: '"ACTIVE_CAMP_ACTIVE_CAMPAIGN_ID_C"' label: Active Campaign Active Campaign ID group_label: Active Campaign ``` -------------------------------- ### Markdown KPI Visualization with Mustache Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text This example demonstrates using Mustache tags to reference specific values from a query's result set within a Markdown KPI visualization. It dynamically inserts order counts, product brands, user states, and average selling prices. Line breaks are added for readability. ```mustache There have been **{{result._totals._first.order_items.order_count.value}}** orders placed for **{{result._first.products.brand.value}}** in **{{result._first.users.state.value}}**, and the average selling price is **{{result._first.order_items.sale_price_average.value}}**. See the πŸ—ΊπŸ“ below for **{{result._first.products.brand.value}}** stores in the top selling city - **{{result._first.users.city.value}}, {{result._first.users.state.value}}**. ``` -------------------------------- ### Topic File Parameters Configuration Source: https://docs.omni.co/docs/modeling/topics/parameters A comprehensive list of parameters for defining topic configurations. This includes settings for base views, labels, access filters, AI context, default filters, and more, allowing for detailed control over how a topic is presented and accessed. ```yaml # Defines the base view for the topic base_view: # Defines the workbook display name of the base view when it's accessed from the topic base_view_label: # Limits access to rows based on user attributes access_filters: - field: . user_attribute: values_for_unfiltered: [, , ...] # Information that provides context to the AI Query Helper ai_context: # Inserts a non-removable filter always_where_filters: .: # Inserts a non-removable filter into the WHERE clause of the generated SQL block of all queries in the topic always_where_sql: ${.} # Forces all queries using the topic to require a run click to return new results auto_run: true # Defines the cache policy for the topic cache_policy: # Defines a removable filter that's applied to all rows in a topic default_filters: .: # Description of the topic, which will display in the workbook description: # Determines the order in which the topic displays display_order: # Curates the fields available in the topic fields: [all_views.*] # Defines the group the topic belongs to; useful for organizing multiple topics in a model group_label: # Removes the topic from the workbook hidden: false # Declares other views as part of the topic joins: : {} # Defines a display name for the topic, which will be visible in the workbook label: # Defines a list of topic-level joins relationships: - join_from_view: join_to_view: join_to_view_as: join_type: always_left on_sql: ${.id} = ${.some_id} relationship_type: many_to_one # Defines a list of access grants to apply to the topic required_access_grants: # Adds example queries to the topic, useful for AI sample_queries: query_name: query: fields: [ .* ] base_view: calculations: : limit: sorts: - field: . topic: description: # If false, query will display as an example when topic is selected hidden: false prompt: ai_context: # If true, query is excluded from AI context for the topic exclude_from_ai_context: false # Allows customization of views only in the context of the topic views: : ``` -------------------------------- ### Omni Control Metadata Examples Source: https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text/mustache-reference These examples show how to access metadata for dashboard controls in Omni, such as label, summary, value, and JSON representation. This is supported in dashboard Markdown tiles. ```Markdown Label: `{{controls.control_id.label}}` Summary: `{{controls.control_id.summary}}` Value: `{{controls.control_id.value}}` JSON: `{{controls.control_id.json}}` ``` -------------------------------- ### Example Model ID Extraction from URL Source: https://docs.omni.co/docs/ai/mcp/vscode This example demonstrates how to extract the Model ID from a Omni model's URL in VS Code. The Model ID is the unique string found between '/models/' and '/ide/'. ```text https://blobsrus.omniapp.co/models/9d9440e5-8522-4507-b092-1ac26ba26673/ide/model?mode=combined ``` -------------------------------- ### Validate Model Branch API Request (cURL) Source: https://docs.omni.co/docs/API/model Example cURL command to validate a specific branch of a model using the GET /api/v1/models/:modelId/validate?branchId= endpoint. Requires authentication. ```bash curl -L "https://blobsrus.omniapp.co/api/v1/models/123e4567-e89b-12d3-a456-426614174000/validate?branchId=123e4567-e89b-12d3-a456-426614174001" \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### XLOOKUP Function Syntax and Example Source: https://docs.omni.co/docs/querying-and-sql/table-calculations/position-functions Demonstrates the basic syntax and an example of the XLOOKUP function. This function searches for a lookup value in a specified range and returns a corresponding value from another range. The lookup range must be a single, full column. ```spreadsheet XLOOKUP(lookup_value, !, !) ``` ```spreadsheet XLOOKUP(C1,'State Mottos'!A:A,'State Mottos'!B:B) ``` -------------------------------- ### Combined Filters: AND Condition Source: https://docs.omni.co/docs/modeling/filters Example demonstrating how to apply an AND condition to multiple filters on the same field, requiring all conditions to be met. ```yaml filters: users.created_at: and: - time_for_duration: [ 1 week ago, 1 week ] - before: 1 days ago ``` -------------------------------- ### CSS Styling for Omni.co Cards and Metrics Source: https://docs.omni.co/docs/visualization-and-dashboards/visualization-types/markdown/examples/gradient-card This CSS code defines the styling for a card component and its associated metrics within the Omni.co project. It includes styles for layout, typography, responsiveness, and visual elements like gradients and icons. Dependencies include browser support for CSS variables and Flexbox/Grid layouts. ```css .md-card { display: flex; background: linear-gradient( 132deg, #8eecd5 2.13%, #9DAAF4 67.53%, #F7A8CB 90% );; padding: var(--size4); border-radius: var(--radius-md); color: var(--color-text-inverse); justify-content: center; height: 100%; align-items: center; } .md-card-metrics { display: flex; flex-direction: column; gap: var(--size4); margin: 0; padding: 0; list-style: none; width: 100%; align-items: center; justify-content: center; } .md-card-metrics li { padding-block: var(--size4); padding-inline: var(--size6); display: grid; grid-template-columns: max-content 1fr; width: 100%; } @media (width >= 769px) { .md-card-metrics { flex-direction: row; } .md-card-metrics li { max-width: calc(4px * 70); } } .md-metric-emoji { font-size: 52px; color: var(--color-text-inverse); margin: 0; grid-row: 1 / 3; display: flex; align-items: center; padding-inline: 0 var(--size4); } .md-metric-label { font-size: 14px; color: var(--color-text-inverse); opacity: 0.66 } .md-metric-value { font-size: 36px; line-height: 1; font-weight: bold; } ``` -------------------------------- ### Get Week Number with WEEKNUM Function Source: https://docs.omni.co/docs/querying-and-sql/table-calculations/date-time-functions Returns the week number of the year for a given date. It accepts the date and an optional type argument to specify the starting day of the week (defaults to Sunday). ```Formula WEEKNUM(date, [type]) ``` ```Formula WEEKNUM("2022-12-22", 2) ``` -------------------------------- ### Query Sub-parameter: bind Syntax and Example Source: https://docs.omni.co/docs/modeling/query-views Provides the syntax and an example for the 'bind' sub-parameter within the 'filters' of a query. 'Bind' is used to pass specific filter values from other fields into a subquery, complementing 'bind_all_filters' for broader filter propagation. ```yaml filters: view.field: bind: other_view.other_field ``` ```yaml # Here we bind any use of order_items.created_at to users.created_at query: fields: users.id: id order_items.sale_price_sum: sale_price_sum base_view: order_items filters: users.created_at: bind: order_items.created_at sorts: - field: order_items.sale_price_sum desc: true topic: order_items ``` -------------------------------- ### Create Connection Environments Source: https://docs.omni.co/docs/API/guides/connection-environments Associates a base connection with one or more environment connections, defining the structure for environment-based database routing. ```APIDOC ## POST /api/v1/connection-environments ### Description Associates a base database connection with one or more environment-specific connections. This API is used to link different database configurations based on user attributes. ### Method POST ### Endpoint /api/v1/connection-environments ### Parameters #### Request Body - **baseConnectionId** (string) - Required - The ID of the base connection. - **environmentConnectionIds** (string or array of strings) - Required - The ID(s) of the environment connection(s). ### Request Example ```json { "baseConnectionId": "c0f12353-4817-4398-bcc0-d501e6dd2f64", "environmentConnectionIds": "b31f9c9f-208d-48a2-9ae3-ff80f2c79fed" } ``` ### Response #### Success Response (200) - **connectionEnvironmentId** (string) - The ID of the created connection environment. #### Response Example ```json { "connectionEnvironmentId": "" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.