findList()

The findList() function (client-side) retrieves metadata and content for a static or CSV product table. To retrieve the table content, the table must be preloaded. To preload the table content, check the Preload static and CSV tables for actions box on the product record. If it's a CSV table, also check the Allow preloading CSV table box on the table record. For more information about static and CSV tables, see Storing Answer Options in Tables.

Syntax

Use these syntax formats for the findList() function:

  • To retrieve the table using its code, use:

                    findList('TABLE_CODE'); 
    
                  
  • To retrieve the table using its name, use:

                    findList('table name'); 
    
                  
    Note:

    Use this syntax only if the table hasn't a code assigned.

Return Value

The findList() function returns an object that contains metadata about the specified static or CSV table, as well as its content (if preloaded). The returned object has the following structure:

            {
  "id": "",
  "internalid": "",
  "name": "",
  "code": "",
  "cols": "",
  "file": "",
  "type": "",
  "rectype": "",
  "filter": "",
  "fields": "",
  "preload": "",
  "csvDelimiter": "",
  "csvEscapeCharacter": "",
  "json": "",
  "allowDups": "",
  "status": "",
  "content": []
} 

          

Parameters

The findList() function accepts one required parameter, which is either the code or the name of the table for which you want retrieve information. You can find the name or the code in the Name or Code field on the table record.

Examples

The following examples show how to use the findList() function.

Retrieving Information and Content of a Table

This example retrieves the information of a table containing color codes.

              const tableData = findList('COLOR_CODES');
console.log(tableData); 

            

Related Topics

General Notices