Snippets

Piotr Szrajber Smart M.App - get original BI column names

Created by Piotr Szrajber
/**
 * Get original column names for a given stage (uses private API).
 *
 * 2018-04-12 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>
 */
const hasColumnNames = (stageId) => new Promise((resolve, reject) => {
    stageId = stageId || "zbyszek"; // default stage's id
    mainContext.businessIntelligence.configReader.loadConfigurations().then((configs) => {
        const config = configs.find(x => x.stageModel.id === stageId);
        if (!config)
            reject();
        else {
            const columnNames = config.tableMetadata.attributes.map((attribute) => attribute.name);
            resolve(columnNames);

        }
    }).catch(reject);
});

hasColumnNames( /*your stage id*/ ).then(console.log);

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.