✅ You are viewing documentation for the latest version of Compose SDK.
Version:
# Class FormulaService Fusion Embed
Service for working with shared formulas.
# Constructors
# constructor
new FormulaService(
sisenseContextService):FormulaService
# Parameters
| Parameter | Type |
|---|---|
sisenseContextService | SisenseContextService |
# Returns
# Methods
# getSharedFormula
getSharedFormula(
params):Promise<CalculatedMeasure|null>
Fetch a shared formula (opens new window) from a Fusion instance.
The formula can be identified either by oid or by name and dataSource pair.
When the retrieval is successful but the shared formula is not found, the result is null. When the retrieval is not successful, the promise is rejected with an error.
# Example
Retrieve a shared formula by oid:
try {
const formula = await formulaService.getSharedFormula({
oid: 'd61c337b-fabc-4e9e-b4cc-a30116857153',
});
if (formula) {
console.log('Formula found:', formula);
} else {
console.log('Formula not found');
}
} catch (error) {
console.error('Error:', error);
}
# Example
Retrieve a shared formula by name and data source:
try {
const formula = await formulaService.getSharedFormula({
name: 'My Shared Formula',
dataSource: DM.DataSource,
});
if (formula) {
console.log('Formula found:', formula);
} else {
console.log('Formula not found');
}
} catch (error) {
console.error('Error:', error);
}
# Parameters
| Parameter | Type | Description |
|---|---|---|
params | GetSharedFormulaParams | Parameters for retrieving the shared formula. Must include either oid or both name and dataSource. |
# Returns
Promise< CalculatedMeasure | null >
Promise that resolves to the shared formula, or null if not found