SharpSync
  • Welcome
  • Fundamentals
    • Getting Started
      • Registration
      • Landing Page
      • Support
      • Subscription
    • Data Sources
    • Property Mappings
      • Adding Property Mapping
      • Property Mapping Settings
    • Rules
      • Import / Export
        • Append text
        • Calculate number
        • Export manipulation
        • Format as decimal number
        • Prepend text
        • Remove property
        • Replace all instances
        • Replace first instance
        • Round to nearest X
        • Select from JSON
        • Set cell value
        • Set empty cells
        • Text manipulation
      • Display
        • Number between
        • Text contains
        • Text ends with
        • Text evaluation
        • Text is a number
        • Text is exactly
        • Text is in list
        • Text is not a number
        • Text is not empty
        • Text is not in list
        • Text length between
        • Text length is exactly
        • Text maximum length
        • Text minimum length
        • Text not contains
        • Text not ends with
        • Text not starts with
        • Text starts with
      • Advanced Scripting
    • BOM Comparison
    • Data Safety
    • Troubleshooting
      • Duplicate component paths
      • OAuth 2.0
  • Data Sources
    • Autodesk Inventor
    • CSV
      • Getting Started
      • Importing a Bill of Materials (BOM)
    • MS Dynamics 365 Business Central
      • Getting Started
      • Item Fields Json & Internal Names
      • Resource Fields Json & Internal Names
      • List Names For nestedObject Mappings
    • NetSuite
      • OAuth Setup
        • Permissions
      • RESTlet Script Setup
        • SharpSync RESTlet Script
      • Thumbnail Folder Setup
      • Authentication + Configuration
      • Common setup
        • Configure quantity mapping
        • Configure accounts mappings
        • Configure itemType mapping
        • Configure isPhantom mapping
        • Configure subsidiary mapping
        • Configure price mapping
        • Configure Where Used Link mapping
        • Configure thumbnail mapping
        • Read-Only NetSuite Fields
        • Common Mapping Rules
        • Common List names
      • Advanced Bill of Materials
      • Configure Routings
      • Integration tips
      • Troubleshooting
    • Odoo
      • Getting Started
        • Authentication + Configuration
        • Debugging tips
      • Common Setup
        • Map BOM Codes
        • Map BOM Types
        • Map Attribute Values
          • Reading Attributes - Overview
          • Display All Attribute Names
          • Display Single Attribute Values
          • Writing attributes
      • Product Management
      • Hosting Options
      • List Names
      • Permissions
      • Troubleshooting
    • Onshape
      • Getting Started
      • Setting up Derivatives
    • Propel PLM
      • Getting Started
    • SolidWorks
    • SolidWorks PDM
      • Downloading and installing the add-in
      • Configure the add-in
      • Setting up the Solidworks PDM Web 2
      • Troubleshooting
      • Submitting a BOM for update
  • Advanced
    • Derivatives
  • User management
    • User Management
    • Application Permissions
Powered by GitBook
On this page
  1. Fundamentals
  2. Rules
  3. Display

Text evaluation

PreviousText ends withNextText is a number

Last updated 4 months ago

Type: Display

Description: Evaluates the cell value given the JavaScript expression.

This is an advanced rule which requires programming knowledge. It is more difficult to use, but much more powerful.

See the section for more detail.

Example: Check material name
  • Cell value: Stainless Steel 304

  • Rule value:

/* if the string is blank, return unknown */
if (!s & !rowData.isAssemblyRow) 
  return { message: 'unknown material' }
  • Result: Rule passes.

Example: Warn on empty or invalid rows for non-assemblies
  • Cell value: [blank]

  • Rule value:

/* if the string is blank and its a component, return warning */
if (!rowData.isAssemblyRow && !s) 
  return { message: `No material specified for this component`};

/* check for valid combinations */
if (s.toLower().includes('steel') && rowData.cells.partNumber.endsWith('RR'))
    return { message: `Invalid material specified for this component`};
  • Result:

    • Rule fails for non-assembly rows. Cell border is marked orange or red (depending on your pass / block setting)

    • Rule passes for assembly rows

Example: Empty revision must block
  • Cell value: [blank]

  • Property mapping setting: Is Readonly = checked

  • Rule value:

/* if the string is blank and its a component, return warning */
if (!s && pm.isReadOnly) 
  return { message: `The revision is blank. Please update at the source and reload the BOM`};
  • Result:

    • Rule fails and warning is shown, but only if the Property Mapping is marked as read-only.

For further details, reach out to us on our Support Ticket system.

Advanced Scripting