embed.on(EmbedEvent.CustomAction, e => {
const underlying = await e.answerService.getUnderlyingDataForPoint([
'col name 1'
]);
const data = await underlying.fetchData(0, 100);
})
AnswerService
Class representing the answer service provided with the custom action payload. This service could be used to run graphql queries in the context of the answer on which the custom action was triggered.
Version : SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
embed.on(EmbedEvent.Data, async (e) => {
const service = await embed.getAnswerService();
await service.addColumns([
"<column guid>"
]);
console.log(await service.fetchData());
});
Indexπ
Constructorsπ
Should not need to be called directly.
new AnswerService(session: SessionInterface , answer: any , thoughtSpotHost: string , selectedPoints?: VizPoint[] ) : AnswerService
Should not need to be called directly.
Function Parameters
- session
-
-
session: SessionInterface
-
- answer
-
-
answer: any
-
- thoughtSpotHost
-
-
thoughtSpotHost: string
-
- selectedPoints
-
Optional
-
selectedPoints: VizPoint[]
-
Returns
Defined in : utils/graphql/answerService/answerService.ts
Methodsπ
addColumnsπ
addColumns(columnIds: string[] ) : Promise< any >
Add columnIds and return updated answer session.
Function Parameters
- columnIds
-
-
columnIds: string[]
-
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
addColumnsByNameπ
addColumnsByName(columnNames: string[] ) : Promise< any >
Add columns by names and return updated answer session.
Function Parameters
- columnNames
-
-
columnNames: string[]
-
Returns
Promise< any >
embed.on(EmbedEvent.Data, async (e) => {
const service = await embed.getAnswerService();
await service.addColumnsByName([
"col name 1",
"col name 2"
]);
console.log(await service.fetchData());
});
[definedInTag]#Defined in : link:https://github.com/thoughtspot/visual-embed-sdk/blob/main/src/utils/graphql/answerService/answerService.ts#L132[utils/graphql/answerService/answerService.ts, window=_blank]#
addDisplayedVizToLiveboardπ
addDisplayedVizToLiveboard(liveboardId: string ) : Promise< any >
Function Parameters
- liveboardId
-
-
liveboardId: string
-
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
addFilterπ
addFilter(columnName: string , operator: RuntimeFilterOp , values: string | number | bigint | boolean[] ) : Promise< any >
Add a filter to the answer.
Function Parameters
- columnName
-
-
columnName: string
-
- operator
-
-
operator: RuntimeFilterOp
-
- values
-
-
values: string | number | bigint | boolean[]
-
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
executeQueryπ
executeQuery(query: string , variables: any ) : Promise< any >
Execute a custom graphql query in the context of the answer.
Function Parameters
- query
-
-
query: string
-
graphql query
- variables
-
-
variables: any
-
graphql variables
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
fetchCSVBlobπ
fetchCSVBlob(userLocale?: string = 'en-us', includeInfo?: boolean = false) : Promise< Response >
Fetch the data for the answer as a CSV blob. This might be quicker for larger data.
Function Parameters
- userLocale
-
-
userLocale: string = 'en-us'
-
- includeInfo
-
-
includeInfo: boolean = false
-
Include the CSV header in the output
Returns
Promise< Response >
Defined in : utils/graphql/answerService/answerService.ts
fetchDataπ
fetchData(offset?: number = 0, size?: number = 1000) : Promise< {columns: any , data: any } >
Fetch data from the answer.
Function Parameters
- offset
-
-
offset: number = 0
-
- size
-
-
size: number = 1000
-
Returns
Promise< {columns: any , data: any } >
Defined in : utils/graphql/answerService/answerService.ts
fetchPNGBlobπ
fetchPNGBlob(userLocale?: string = 'en-us', omitBackground?: boolean = false, deviceScaleFactor?: number = 2) : Promise< Response >
Fetch the data for the answer as a PNG blob. This might be quicker for larger data.
Function Parameters
- userLocale
-
-
userLocale: string = 'en-us'
-
- omitBackground
-
-
omitBackground: boolean = false
-
Omit the background in the PNG
- deviceScaleFactor
-
-
deviceScaleFactor: number = 2
-
The scale factor for the PNG
Returns
Promise< Response >
Defined in : utils/graphql/answerService/answerService.ts
getAnswerπ
getAnswer() : Promise< any >
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
getFetchCSVBlobUrlπ
getFetchCSVBlobUrl(userLocale?: string = 'en-us', includeInfo?: boolean = false) : string
Just get the internal URL for this answerβs data as a CSV blob.
Function Parameters
- userLocale
-
-
userLocale: string = 'en-us'
-
- includeInfo
-
-
includeInfo: boolean = false
-
Returns
string
Defined in : utils/graphql/answerService/answerService.ts
getFetchPNGBlobUrlπ
getFetchPNGBlobUrl(userLocale?: string = 'en-us', omitBackground?: boolean = false, deviceScaleFactor?: number = 2) : string
Just get the internal URL for this answerβs data as a PNG blob.
Function Parameters
- userLocale
-
-
userLocale: string = 'en-us'
-
- omitBackground
-
-
omitBackground: boolean = false
-
- deviceScaleFactor
-
-
deviceScaleFactor: number = 2
-
Returns
string
Defined in : utils/graphql/answerService/answerService.ts
getSQLQueryπ
getSQLQuery() : Promise< string >
Returns
Promise< string >
Defined in : utils/graphql/answerService/answerService.ts
getSessionπ
getSession() : SessionInterface
Get the internal session details for the answer.
Returns
Defined in : utils/graphql/answerService/answerService.ts
getSourceDetailπ
getSourceDetail() : Promise< any >
Get the details about the source used in the answer. This can be used to get the list of all columns in the data source for example.
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
getTMLπ
getTML() : Promise< any >
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
getUnderlyingDataForPointπ
getUnderlyingDataForPoint(outputColumnNames: string[] , selectedPoints?: UnderlyingDataPoint[] ) : Promise< AnswerService >
Get underlying data given a point and the output column names. In case of a context menu action, the selectedPoints are automatically passed.
Function Parameters
- outputColumnNames
-
-
outputColumnNames: string[]
-
- selectedPoints
-
Optional
-
selectedPoints: UnderlyingDataPoint[]
-
Returns
Promise< AnswerService >
Version : SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
embed.on(EmbedEvent.CustomAction, e => {
const underlying = await e.answerService.getUnderlyingDataForPoint([
'col name 1' // The column should exist in the data source.
]);
const data = await underlying.fetchData(0, 100);
})
Defined in : utils/graphql/answerService/answerService.ts
removeColumnsπ
removeColumns(columnIds: string[] ) : Promise< any >
Remove columnIds and return updated answer session.
Function Parameters
- columnIds
-
-
columnIds: string[]
-
Returns
Promise< any >
Defined in : utils/graphql/answerService/answerService.ts
setTMLOverrideπ
setTMLOverride(override: any ) : void
Function Parameters
- override
-
-
override: any
-
Returns
void
Defined in : utils/graphql/answerService/answerService.ts