Please enable JavaScript to view this site.

Knowledge Bridge Documentation

Help version: 3.3.8

Navigation: Reference 

Rules Using External Libraries

Scroll Prev Top Next More

 

Select JavaScript libraries can be used in kBridge rules. The most important is the lodash library, which contains a large number of functions, methods, and calls.

 

Other available libraries, all of which call for the require() keyword, are as follows:

axios

docx-templates

edge-js

formulajs

mssql

mysql

sqlite

three.js

xlsx

xlsx-calc

xml2js

 

Example of a Lodash Call In a kBridge Rule

 

RuleWIthLodashCallRET

 

 

 

_.uniq is a function that is contained in the Lodash library. It creates a duplicate-free version of an array, using the JavaScript SameValueZero algorithm for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.

 

 

kBridgeExampleIcon

 

 

You can view the Lodash library with this link: https://lodash.com/docs/4.17.15

You can also reference the Lodash library through the ExternalLibraries project.

 

Here is how to use the ExternalLibraries project.

 

Project Example:

In your kBridge Examples Projects folder, open the project called ‘ExternalLibraries.

 

ExternalLibraries0

 

Press the Run Custom UI icon to start the User Interface.

 

ExternalLibraries1

 

 

On the right are the different Methods from the Lodash library. Note that you must declare the Underscore variable in your statement.

Example:

 

const _ = require("lodash");
return _.difference([2, 1], [2, 3]);
 
// => [1]

 

 

ExternalLibraries2

 

When you make a selection from the UIDropdown menu a link will appear.

 

ExternalLibraries3

 

Click on the link and you will be directed to the method that you selected.

 

ExternalLibraries4

 

 

 

 

 

Knowledge Bridge from Engingeering Intent is a full-featured engineering and sales automation environment