VQL Queries

VQL (VARIO Query Language) is a SQL-like query language for retrieving data from VARIO ERP. It is the primary way to fetch articles, stock levels, prices, customers, and other business data in shop integrations.

Basic Syntax

VQL follows a familiar SELECT-FROM-WHERE pattern:

SELECT field1, field2, field3
FROM entity.dataSource
WHERE condition = 'value'
ORDER BY field1 ASC
LIMIT 100
OFFSET 0

Executing VQL Queries

Use the ErpApi.vql() static method to run queries:

const ErpApi = require('@vario-software/vario-app-framework-backend/api/ErpApi');

const result = await ErpApi.vql(
  `SELECT id, articleNumber, descriptions.description
   FROM article.queryArticles
   WHERE active = true
   LIMIT 50`,
  {},    // variables (optional)
  50,    // limit
  0      // offset
);

const articles = result.data;

The method returns an object with a data array containing the query results.

Common Queries for Shop Integrations

Articles (Products)

Article Variants

Stock

Prices

Customers (Accounts)

Custom Fields (EAV)

Access custom fields stored in EAV groups using the custom. prefix:

Filtering

Comparison Operators

String Matching

Logical Operators

IN Clause

Pagination

Use LIMIT and OFFSET for paginated queries:

Ordering

Performance Tips

  • Limit your fields — Only select the fields you need. Selecting fewer fields is faster.

  • Use pagination — Never fetch unbounded result sets. Always include LIMIT.

  • Filter early — Add WHERE clauses to reduce the result set before the ERP processes it.

  • Avoid LIKE with leading wildcardsLIKE '%value' is slower than LIKE 'value%' because it can't use indexes.

For more performance recommendations, see Performance.

Last updated

Was this helpful?