Centara
  • Introduction to Centara
  • Getting started with Centara
    • Software and hardware requirements
    • getCentara.exe
    • Install Centara Server
    • Centara Configuration
      • RDM overview
      • Create organization structure
      • General settings
      • Layouts and visual components
        • Creating layouts
        • Assigning layouts in configuration
        • Populating layouts with components
        • Applying functionalty to buttons
        • UI component reference
      • Hardware
        • OPOS installation
          • Epson OPOS
        • Centara server configuration
      • POS Receipts
        • Receipt parts
        • Receipt Directives
          • Formatting directives
          • General directives
          • Hospitality directives
          • Fiscal Printers directives
          • Tender slip directives
        • Receipt logo
        • Receipt template
          • Special formatting
      • POS operators and permissions
        • Create operators and permissions
      • Tenders
      • Other configuration
        • Customer configuration
        • Cash management
          • Setting up cash management
          • Balance report
        • Suspend / retrieve
        • Search
          • Applying customer search
          • Applying product search
            • Style search
            • Stock search
          • Applying transaction search
        • Custom settings
    • Install Centara POS
      • Alternative database configurations
      • Centara Licensing
    • Features
      • Conditional sub-layouts
      • Out of stock warning
  • User guides
    • POS User Guide
      • Operator sign on / off
      • Layouts
      • Selling products
      • Paying for products
      • Voiding
      • Customers
      • Suspend / retrieve
      • Cash management
    • Discount Offer module
      • Getting started
      • Basic discounts
      • Package deals
      • Seasonal offers
      • Miscellaneous
      • Working with the filters
      • Making changes to the discounts
      • Time restrictions
      • Selectors
      • Layered discounts
      • Audit Log
      • Glossary of Terms
    • Loyalty system
      • System overview
      • Creating organization stucture
      • Working with loyalty data
        • General handling
          • Adding loyalty data
        • Giftcards
          • Adding gift card data
        • Store credit
          • Instrument handling
        • Coupons
          • How to setup alphanumeric offer coupon
      • Connecting Centara to Loyalty
      • View loyalty data on POS
      • Loyalty operations
    • Snippet manager
  • Integrations
    • Sentry.io
    • Acumatica
      • Acumatica installation
      • Acumatica Connector
        • Customer creation
        • Cashier Groups
        • Avalara Configuration
        • Common configuration errors
        • General inquiries
  • Development
    • APIs
      • External orders
      • Item API
      • Loyalty API
        • Gift cards
        • Loyalty cards
        • Store credit
    • GraphQL
    • XVal
      • XVal List comprehensions
      • XVal operators
      • XVal examples
      • XVal usage
      • XVal testing
  • References
    • Data processes
      • XVal Library
      • Data process examples
    • POS macros
  • FAQ
    • Centara Server
      • Installation
      • Maintenance
    • Centara POS
Powered by GitBook
On this page

Was this helpful?

  1. References
  2. Data processes

XVal Library

The XVal library is accessible through the lib name

Function

Description

Example

List functions

nth [n] [list]

Returns the nth element of list

enumerate []

Returns a list of pairs [n, x] where n is the index of element x

fst [pair]

Returns the first element of pair where pair is a list of two elements

snd [pair]

Returns the second element of pair where pair is a list of two elements

length [list]

Returns the number of elements in list

exists [test] [list]

Returns true if the supplied function test returns true when applied to one element in list

flatten [nested-list]

Flattens one level of a 2-deep nested list

lib.flatten [ [a,b], [1,2] ] // returns: [ a, b, 1, 2 ]

listConcat [list1] [list2]

Returns a single list containing first all the elements of list1 and then all the elements of list2

guardLength [max-length message text]

Validates that text is no more than max-length characters long and throws an error with message if the check fails.

General functions

toString [value]

Returns a string representation of value

raiseError [message]

Throws an exception, throwing message

Date time functions

datetime.normalizeDate [date]

Returns date as a YYYY-MM-DD string

datetime.localizeDate [date]

Returns date as on the local culture format

datetime.today

Returns today’s date in YYYY-MM-DD format

datetime.addDays [date days]

Calculates a future (or past, if days is negative) date

datetime.fromAppInfo [day: AppInfo]

Converts a string in a Centara AppInfo (blob) format to a datetime object

datetime.toAppInfo [day: DateTime]

Converts a datetime object to a Centara AppInfo (blob) format

datetime.fromMacro [day: String]

Converts a string in a Centara macro format to a datetime object

datetime.toMacro [day: DateTime]

Converts a datetime object to a Centara macro format

String functions

string.toUpper [text]

Returns text in upper case

string.toLower [text]

Returns text in lower case

string.startsWith [value text]

Tests if text starts with value

string.endsWith [value text]

Tests if text ends with value

string.contains [value text]

Tests if text contains value

string.length [text]

Returns the number of characters in text

Regex functions

regex.test [pattern text]

Tests if the pattern regular expression matches text

regex.split [text]

Splits text using the pattern regular expression

regex.replace [pattern replacement text]

Replace pattern with replacement in text

PreviousData processesNextData process examples

Last updated 5 years ago

Was this helpful?