Skip to content

Latest commit

 

History

History
674 lines (419 loc) · 12.6 KB

functions.md

File metadata and controls

674 lines (419 loc) · 12.6 KB

Table of Contents

CreateDimension

Create a Dimension in the calling app.

Parameters

Examples

Without Grouping: CreateDimension(nameField, defField, descField,tagsField)
With Grouping(Hierarchy): CreateDimension(nameField Hierarchy, defListField ,descField,tagsField,labelField)
Without Grouping :CreateDimension('Country', 'Country',Country of Supplier, 'Sales,Company A')
With Grouping(Hierarchy):CreateDimension('Calendar Date Hierarchy', 'Year,Month,Date' , 'Hierarchy Fiscal Year -> Fiscal Period -> Date', 'Time')

Returns string status - "Created" or "Replaced" plus any validation error messages.

CreateMeasure

Create a Measure in the calling app.

Parameters

Examples

CreateMeasure(nameField, defField, descField,tagsField,labelField)
CreateMeasure('Total Sales', 'Sum(Sales)','Total Sales Aggregation Master Item','KPI,Annual','='Sales extraction date:'& today()')

Returns string status - "Created" or "Replaced" plus any validation error messages.

CreateMeasureFromProperties

Create a Measure in the calling app.

Parameters

  • props string MeasureProps in JSON format

Examples

CreateMeasureFromProperties(measureDefField)

Returns string status - "Created" or "Replaced" plus any validation error messages.

DecodeURI

The decodeURI() function decodes a Uniform Resource Identifier (URI) previously created by encodeURI() or by a similar routine.

Parameters

Examples

DecodeURI('my%20test.asp?name=st%C3%A5le&car=saab')  // returns 'my test.asp?name=ståle&car=saab'

Returns string

DecodeURIComponent

The decodeURIComponent() function decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.

Parameters

Examples

EncodeURIComponent('https%3A%2F%2Fw3schools.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab')  // returns 'https://w3schools.com/my test.asp?name=ståle&car=saab'

Returns string

Decrypt

Decrypt a value.

Parameters

  • ciphertext string to decrypt, as generated by the Encrypt() function.
  • passphrase string to decrypt with. This must be the same passphrase that was used in Encrypt().

Examples

Decrypt(EncCreditCard, 'secret phrase')

Returns string unencrypted text.

DeleteDimension

Delete a Dimension by proving its name in app the request was executed in.

Parameters

Examples

DeleteDimension(dimensionName)
DeleteDimension('Calendar Date')

Returns string status - "Deleted" plus any validation error messages.

DeleteMeasure

Delete a Measure by proving its name in the app request was executed in.

Parameters

Examples

DeleteMeasure(MeasureName)
DeleteMeasure('Total Sales')

Returns string status - "Deleted" plus any validation error messages.

EncodeURI

Encodes a Uniform Resource Identifier (URI).

Parameters

Examples

EncodeURI('my test.asp?name=ståle&car=saab')  // returns 'my%20test.asp?name=st%C3%A5le&car=saab'

Returns string

EncodeURIComponent

Encodes a Uniform Resource Identifier (URI) component.

Parameters

Examples

EncodeURIComponent('my test.asp?name=ståle&car=saab')  // returns 'my%20test.asp?name=st%C3%A5le&car=saab'

Returns string

Encrypt

Encrypt a value.

Parameters

  • plaintext string to encrypt.
  • passphrase string to encrpyt with.

Examples

Encrypt(CreditCard, 'secret phrase')

Returns string encrypted text.

ExampleAggregation

Sample of Aggregation FunctionType. Sums the value of a field, same as Qlik Sum().

Parameters

Examples

ExampleAggregation(myfield)

Returns number

ExampleScalar

Sample of Scalar FunctionType. Returns true if num1 GT num2, otherwise false

Parameters

Examples

ExampleScalar(field1, field2)

Returns number boolean

ExampleTensor

Sample of Tensor FunctionType.

Aggregates column2 values by column1 dim values.

Same as script "LOAD Col1 as Dim, Sum(Col2) as Value FROM .. Group By Col1"

Parameters

  • tablename tabledescription {dim, value} - describing two fields, dim being Dimension, value is field to aggregate. See

Returns table table with two columns, "Dim", "Value"

ExtractHtmlText

Extracts text node contents from an HTML string.

Parameters

Returns string text - The text value, which should be the HTML string minus tag elements.

GetAppLineage

Gets the lineage information of the app.
Current SSE specification requires AppId to be specified as a Field.

Parameters

  • Tablename tabledescription {AppId}

Examples

TempId:
LOAD '\Documents\Qlik\Sense\Apps\Sales Discovery.qvf' as AppId
AutoGenerate 1;

LoadedMeasures:
Load * Extension QCB.GetAppLineage(TempId{AppId});

Returns string json qLineage(s)

GetDimensions

Load Dimensions as JSON from an app.
Current SSE specification requires AppId to be specified as a Field.

Parameters

  • Tablename tabledescription {AppId}

Examples

TempId:
LOAD '\Documents\Qlik\Sense\Apps\Sales Discovery.qvf' as AppId
AutoGenerate 1;

LoadedDimensions:
Load * Extension QCB.GetDimensions(TempId{AppId});

Returns string json Dimension(s)

GetMeasures

Load Measures as JSON from an app.
Current SSE specification requires AppId to be specified as a Field.

Parameters

  • Tablename tabledescription {AppId}

Examples

TempId:
LOAD '\Documents\Qlik\Sense\Apps\Sales Discovery.qvf' as AppId
AutoGenerate 1;

LoadedMeasures:
Load * Extension QCB.GetMeasures(TempId{AppId});

Returns string json Measure(s)

LoadFileToString

Load file contents into a string.

Parameters

  • path string absolute or relative to SSE task

Examples

LoadFileToString('./SupportScript.qvs')

Returns string file contents as string

RegexTest

Tests a string for match with a regular expression.

Parameters

  • stringToTest string The string to test with the regular expression.
  • pattern string The regular expression pattern to use in the test.

Returns number boolean - 0 if false, -1 if true.

Reverse

Reverses the characters in a string.

Parameters

Examples

Reverse('Hello World')  // returns 'dlroW olleH'

Returns string

SendMail

Send an email

Parameters

  • fromAddress string
  • toAddress string
  • subject string
  • text string text version of message
  • html string html version of message. Empty string if no html version.

Examples

let status = QCB.SendMail('admin@qlikaroo.com', 'someuser@qlikaroo.com', 'Reload Completed',
'Reload of "' & DocumentTitle() & '" completed at ' & Now(1), '');

Returns string status

SortList

Sorts the elements of a string list into alphabetical order. Leading and trailing spaces are removed from the elements.

A string list is a string where the elements are separated by a common delimiter.

Parameters

Examples

SortList('John, Zack, Aaron', ',')  // returns 'Aaron,John,Zack'
SortList('John| Zack| Aaron' '|')  // returns 'Aaron|John|Zack'

Returns string text - The text value, which should be the HTML string minus tag elements.

Space

Replace multiple spaces between words with count spaces.

Parameters

Examples

Space('Sometimes    more than     one', 1)  // returns 'Sometimes more than one'

Returns string

TransformToString

Transform rows of data to a string using a template. Currently only pug templates supported.

Parameters

  • rowdata string row data
  • inputFormat string one of 'csv' or 'json'
  • template string name of .pug template, default "HtmlTableSimple.pug"

Examples

Load 
  QCB.TransformToString(rowdata, 'csv', '')
Resident RecentSales;

Returns string transformed rows as a single string