tpm-promotion コンポーネントの参照
名前空間
1cgcloudイベント
1{
2 detail : {
3 value: <<new value>>,
4 property: <<the property>>,
5 promotionId: <<promotionId>>,
6 }
7}onfocusedareachange
このイベントは、アプリケーションの別のエリアがナビゲーション先になるたびにトリガーされます。
1{
2 detail : {
3 value: {
4 area: 'PROMOTION_PLANNING',
5 section: 'PROMOTION'
6 },
7 property: 'focusedArea',
8 promotionId: 'a2WTC0000000F772AE',
9 }
10}onisplgridfilteropenchange
このイベントは、P&L 検索条件がオープン (true) またはクローズ (false) されるたびにトリガーされます。
1{
2 detail : {
3 value: true,
4 property: 'isPLGridFilterOpen',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}onstatuschange
このイベントは、tpm プロモーションコンポーネントのライフサイクル状態が変更されるたびにトリガーされます。状況の変更は、プロモーションレコードに対するライフサイクル操作によってトリガーされます。
1{
2 detail : {
3 value: 'VALID',
4 property: 'status',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}oncalculationstatuschange
このイベントは、プロモーショングリッドが計算または再計算されるたびにトリガーされます。
1{
2 detail : {
3 value: 'LOADING',
4 property: 'calculationStatus',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}可能な値は次のとおりです。
- LOADING
- VALID
- ERROR
- DISABLED
oneditmodechange
このイベントは、ページの編集モードが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: true,
4 property: 'editMode',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}onselectedtacticidchange
このイベントは、焦点が当てられた戦略が変更されるたびにトリガーされます。
1{
2 detail : {
3 value: 'a37TC00000014j8YAA',
4 property: 'tacticId',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}onpromotionchange
このイベントは、プロモーション属性が変更されるたびにトリガーされます。
1{
2 detail : {
3 value: {
4 IsNew: false, // Flag to indicate if the record is new
5 IsDeleted: false, // Flag to indicate if the record is deleted
6 Id : 'a2WTC0000000F772AE', // Record id
7 cgcloud__Slogan__c: 'Sample Promotion', // Record attribute.
8 // All Promotion record fields will be present as attributes
9 ...
10 },
11 property: 'promotion',
12 promotionId: 'a2WTC0000000F772AE',
13 }
14}oneffectivecategorieschange
このイベントは、プロモーションの有効なカテゴリが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // Array of Category product ids
4 "01t17000001siy5AAA"
5 ],
6 property: 'effectiveCategories',
7 promotionId: 'a2WTC0000000F772AE',
8 }
9}oneffectivebrandschange
このイベントは、プロモーションの有効なブランドが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // Array of Brand product ids
4 "01t17000001siy5AAA"
5 ],
6 property: 'effectiveBrands',
7 promotionId: 'a2WTC0000000F772AE',
8 }
9}ontacticschange
このイベントは、いずれかの戦略属性が変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // An array of objects
4 {
5 IsNew: false, // Flag to indicate if the record is new
6 IsDeleted: false, // Flag to indicate if the record is deleted
7 Id : 'a37TC00000014j8YAA', // Record id
8 cgcloud__Comment__c: 'Sample Tactic', // Record attribute.
9 // All Tactic record fields will be present as attributes
10 ...
11 // Additional Fields
12 ProductFilter: {...}, // contains the Tactic Product Filter
13 EffectiveCategories: [...] // List of Effective categories for the tactic
14 EffectiveBrands: [...] // List of Effective brands for the tactic
15 },
16 ...
17 ],
18 property: 'tactics',
19 promotionId: 'a2WTC0000000F772AE',
20 }
21}ontacticfundschange
このイベントは、いずれかの戦略資金のプロパティが資産が変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // An array of objects
4 {
5 IsNew: false, // Flag to indicate if the record is new
6 IsDeleted: false, // Flag to indicate if the record is deleted
7 Id : 'a38TC00000014j8YAA', // Record id
8 cgcloud__Fund__c: 'a39TC00000014j8YAA', // Record attribute. Reference to the Fund__c record
9 cgcloud__Tactic__c: 'a37TC00000014j8YAA', // Record attribute. Reference to the Tactic__c record
10 // All Tactic Fund record fields will be present as attributes
11 ...
12 },
13 ...
14 ],
15 property: 'tacticFunds',
16 promotionId: 'a2WTC0000000F772AE',
17 }
18}onpromotionattachmentlinkschange
このイベントは、いずれかのプロモーション添付ファイルリンクのプロパティが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // An array of objects
4 {
5 IsNew: false, // Flag to indicate if the record is new
6 IsDeleted: false, // Flag to indicate if the record is deleted
7 Id : 'a40TC00000014j8YAA', // Record id
8 cgcloud__Promotion_Attachment__c: 'a41TC00000014j8YAA', // Record attribute. Reference to the Promotion_Attachment__c record
9 // All Tactic Fund record fields will be present as attributes
10 ...
11 },
12 ...
13 ],
14 property: 'promotionAttachmentLinks',
15 promotionId: 'a2WTC0000000F772AE',
16 }
17}onpromotionattachmentschange
このイベントは、いずれかのプロモーション添付ファイルのプロパティが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ // An array of objects
4 {
5 IsNew: false, // Flag to indicate if the record is new. Promotion attachments cannot be flagged as new
6 IsDeleted: false, // Flag to indicate if the record is deleted. Promotion attachments cannot be flagged as deleted
7 Id : 'a41TC00000014j8YAA', // Record id
8 cgcloud__Description_Language_1__c: 'Sample Attachment', // Record attribute. Reference to the Promotion_Attachment__c record
9 // All Tactic Fund record fields will be present as attributes
10 ...
11 },
12 ...
13 ],
14 property: 'promotionAttachments',
15 promotionId: 'a2WTC0000000F772AE',
16 }
17}onpromotioncategorieschange
このイベントは、プロモーションカテゴリが変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [ "01t17000001siy5AAA" ],
4 property: 'promotionCategories',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}onparticipatingcustomerschange
このイベントは、プロモーションの参加顧客が変更されるたびにトリガーされます。参加顧客リストは、プッシュプロセスでプロモーションがプッシュされる顧客を決定するときに使用されます。
1{
2 detail : {
3 value: [ // Array of items
4 {
5 "included": true, // Is Included?
6 "externalid": "Supermarkets" // External id of the Participating Customer
7 }
8 ],
9 property: 'participatingCustomers',
10 promotionId: 'a2WTC0000000F772AE',
11 }
12}ontacticconditioncreationdefinitionschange
このイベントは、プロモーション変更値に含まれる戦略の戦略条件作成定義が、戦略条件作成定義 SObject レコードを含む配列である場合に必ずトリガーされます。
1{
2 detail : {
3 value: [ // An array of objects
4 {
5 IsNew: false, // Flag to indicate if the record is new
6 IsDeleted: false, // Flag to indicate if the record is deleted
7 Id : 'a50TC00000014j8YAA', // Record id
8 cgcloud__Tactic__c: 'a37TC00000014j8YAA', // Record attribute.
9 // All Tactic condition creation definition record fields will be present as attributes
10 ...
11 },
12 ...
13 ],
14 property: 'tacticConditionCreationDefinitions',
15 promotionId: 'a2WTC0000000F772AE',
16 }
17}oncustomstatechange
このイベントは、カスタム状態が変更されるたびにトリガーされます。カスタム状態は、プロモーション状態の特別なエリアです。ここで顧客は、Salesforce に送信されてプロモーションと同時に処理およびコミットされるカスタム構造を設定できます。
1{
2 detail : {
3 value: {...} // Custom object
4 property: 'customState',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}onpromotionproductschange
このイベントは、プロモーション商品が変更されるたびにトリガーされます。
1{
2 detail : {
3 value: [
4 '00X000000000000AAA'
5 ],
6 property: 'promotionProducts',
7 promotionId: 'a2WTC0000000F772AE'
8 }
9}onupliftpredictionavailablechange
このイベントは、上昇予測の可用性が変更されるとトリガーされます。プロモーションに対して機能が有効になっているかどうかを示します。
1{
2 detail : {
3 value: {
4 available: true
5 kpi: "PredictedUplift"
6 },
7 property: 'upliftPredictionAvailable',
8 promotionId: 'a2WTC0000000F772AE',
9 }
10}onupliftpredictionenabledchange
このイベントは、現在のプロモーションに対して上昇予測が実行されるとトリガーされます。上昇予測の実行を妨げるプロモーション状態に関するエラーの可能性を示します。
1{
2 detail : {
3 value: {
4 enabled: false,
5 reasons: [
6 "No Uplift Prediction KPI is defined."
7 ]
8 },
9 property: 'upliftPredictionEnabled',
10 promotionId: 'a2WTC0000000F772AE',
11 }
12}onupliftpredictionprocessstatuschange
このイベントは、上昇予測プロセスの状態が変更されるとトリガーされます。
可能な値は次のとおりです。
- RUNNING
- IDLE
1{
2 detail : {
3 value: "RUNNING",
4 property: 'upliftPredictionProcessStatus',
5 promotionId: 'a2WTC0000000F772AE',
6 }
7}tpm-promotion コンポーネントの参照メソッド
tpm-promotion Component Reference のメソッドは次のとおりです。
generateTactic
API バージョン
55
シグネチャー
generateTactic(tacticTemplateId)
実装例
1component.generateTactic('a43TC00000014j8YAA') // tactic Id as parameter
2 .then((tactic) => {
3 // Add the tactic to the Promotion component
4 Object.keys(tactic).forEach((key) => {
5 component.setTacticField(tactic.Id, key, tactic[key]);
6 });
7 });navigateTo
API バージョン
55
シグネチャー
getProperty(target)
実装例
1component.getProperty('promotion');
2
3// Returns a Javascript object with attributes mapped to all promotion SObject
4// attributes
5// {
6// IsNew: false, // Flag to indicate if the record is new
7// IsDeleted: false, // Flag to indicate if the record is deleted
8// Id : 'a2WTC0000000F772AE', // Record id
9// cgcloud__Slogan__c: 'Sample Promotion', // Record attribute.
10// // All Promotion record fields will be present as attributes
11// ...
12// }push
API バージョン
55
シグネチャー
push()
実装例
1// Create callback functions
2const onBeforeSaveCallback = (data) => console.log('onBeforeSave', data.operation === 'push');
3const onAfterSaveCallback = (data) => console.log('onAfterSave', data.operation === 'push');
4const onAfterPushCallback = () => console.log('onAfterPush');
5const onErrorCallback = (error) => console.log('onError', error);
6
7// Setup callback functions
8component.setCallback('onBeforeSave', onBeforeSaveCallback);
9component.setCallback('onAfterSave', onAfterSaveCallback);
10component.setCallback('onAfterPush', onAfterPushCallback);
11component.setCallback('onError', onErrorCallback);
12
13component.push();
14
15// If the promotion is not pushable, onErrorCallback will be executed with an error message
16
17// onBeforeSaveCallback is executed
18// Data is saved to SFDC
19// onAfterSaveCallback is executed
20// Promotion Push process is scheduled
21// onAfterPushCallback is executedreload
API バージョン
55
シグネチャー
reload()
実装例
1component.reload();
2
3// Component will enter the "LOADING" state. After all data is reloaded from
4// SFDC, component will enter the "VALID" state.removeCallback
API バージョン
55
シグネチャー
removeCallback(event, callback)
実装例
1const onBeforeSaveCallback = () => console.log('onBeforeSave');
2
3// Setup callback functions
4component.setCallback('onBeforeSave', onBeforeSaveCallback);
5
6// Remove the callback
7component.removeCallback('onBeforeSave', onBeforeSaveCallback);save
API バージョン
55
シグネチャー
save()
実装例
1// Create callback functions
2const onBeforeSaveCallback = (data) => console.log('onBeforeSave', data.operation === 'save');
3const onAfterSaveCallback = (data) => console.log('onAfterSave', data.operation === 'save');
4const onAfterSyncCallback = () => console.log('onAfterSync');
5
6// Setup callback functions
7component.setCallback('onBeforeSave', onBeforeSaveCallback);
8component.setCallback('onAfterSave', onAfterSaveCallback);
9component.setCallback('onAfterSync', onAfterSyncCallback);
10
11component.save();
12
13// onBeforeSaveCallback is executed
14// Data is saved to SFDC
15// onAfterSaveCallback is executed
16// Promotion is synchronized fo Processing Services
17// onAfterSyncCallback is executedselectTactic
API バージョン
55
シグネチャー
selectTactic(tacticId)
実装例
1component.selectTactic('a37TC00000014j8YAA');
2
3// After executing, the TPM UI will focus the tactic 'a37TC00000014j8YAA'setCallback
API バージョン
55
シグネチャー
setCallback(tacticFunds)
実装例
1// Resolved promise
2
3// Create callback functions
4const onBeforeSaveCallback = (data) => {
5 return new Promise((resolve, reject) => {
6 window.setTimeout(() => {
7 resolve();
8 }, 2000);
9 });
10};
11const onErrorCallback = (error) => console.log('onError', error);
12
13// Setup callback functions
14component.setCallback('onBeforeSave', onBeforeSaveCallback);
15component.setCallback('onError', onErrorCallback);
16
17component.save();
18
19// onBeforeSaveCallback is executed
20// Process wait the returned promise is resolved
21// Data is saved to SFDC
22// Save process continues
23
24// Rejected promise
25
26// Create callback functions
27const onBeforeSaveCallback = (data) => {
28 return new Promise((resolve, reject) => {
29 window.setTimeout(() => {
30 reject(new Error('My Error'));
31 }, 2000);
32 });
33};
34const onErrorCallback = (error) => console.log('onError', error);
35
36// Setup callback functions
37component.setCallback('onBeforeSave', onBeforeSaveCallback);
38component.setCallback('onError', onErrorCallback);
39
40component.save();
41
42// onBeforeSaveCallback is executed
43// Process wait the returned promise is resolved
44// Promise is rejected
45// onErrorCallback is executed with the rejected errorsetCustomState
API バージョン
55
シグネチャー
setCustomState(customState)
実装例
1component.setCustomState(
2 Object.assign({},
3 oldCustomState, // Create a new object using the old one as baseline
4 {
5 myProp: 'Test'
6 }
7 )
8);setEditMode
API バージョン
55
シグネチャー
setEditMode(value)
実装例
1component.setEditMode(true);
2
3// After executing, the TPM UI will set the promotion into edit mode
4
5component.setEditMode(false);
6
7// After executing, the TPM UI will set the promotion into read only modesetParticipatingCustomers
API バージョン
55
シグネチャー
setParticipatingCustomers(participatingCustomers)
実装例
1component.setParticipatingCustomers([ // Array of items
2 {
3 "included": true, // Is Included?
4 "externalid": "Supermarkets" // External id of the Participating Customer
5 }
6]);setPLGridFilterOpen
API バージョン
55
シグネチャー
setPLGridFilterOpen(value)
実装例
1component.setPLGridFilterOpen(true);
2
3// After executing, the TPM UI will open the PL Grid filters
4
5component.setPLGridFilterOpen(false);
6
7// After executing, the TPM UI will close the PL Grid filterssetPromotionAttachmentLinks
API バージョン
55
シグネチャー
setPromotionAttachmentLinks(attachmentLinks)
実装例
1component.setPromotionAttachmentLinks([ // An array of objects
2 {
3 IsNew: false, // Flag to indicate if the record is new
4 IsDeleted: false, // Flag to indicate if the record is deleted
5 Id : 'a40TC00000014j8YAA', // Record id of the Promotion Attachment Link record
6 cgcloud__Promotion_Attachment__c: 'a41TC00000014j8YAA', // Record attribute.
7 // Reference to the Promotion_Attachment__c record
8 // All Tactic Fund record fields will be present as attributes
9 ...
10 },
11 ...
12]);setPromotionAttachments
API バージョン
55
シグネチャー
setPromotionAttachments(attachments)
実装例
1component.setPromotionAttachments([ // An array of objects
2 {
3 IsNew: false, // Flag to indicate if the record is new. Promotion attachments cannot be flagged as new
4 IsDeleted: false, // Flag to indicate if the record is deleted. Promotion attachments cannot be flagged as deleted
5 Id : 'a41TC00000014j8YAA', // Record id of Promotion Attachment record
6 cgcloud__Description_Language_1__c: 'Sample Attachment', // Record attribute. Reference to the Promotion_Attachment__c record
7 // All Tactic Fund record fields will be present as attributes
8 ...
9 },
10 ...
11]);setPromotionCategories
API バージョン
55
シグネチャー
setPromotionCategories(categories)
実装例
1component.setPromotionCategories([ // Array
2 '01t17000001siy5AAA' // Product2 Id referencing a Category record
3]);setPromotionField
API バージョン
55
シグネチャー
setPromotionField(field, value)
実装例
1component.setPromotionField(
2 'cgcloud__Slogan_Language_1__c', // Field name
3 'Test Slogan' // value
4);setSubAccounts
API バージョン
55
シグネチャー
setSubAccounts(subAccounts)
実装例
1component.setParticipatingCustomers([ // Array of items
2 {
3 "volume": 50, // Percent of volume for this sub account.
4 // Sum of included sub accounts volume must be 100 or less
5 "included": true, // Is Included?
6 "externalid": "Supermarkets" // External id of the SubAccount
7 }
8]);setTacticConditionCreationDefinitions
API バージョン
55
シグネチャー
setTacticConditionCreationDefinitions(tacticConditionCreationDefinitions)
実装例
1component.setTacticConditionCreationDefinitions([ // An array of objects
2 {
3 IsNew: false, // Flag to indicate if the record is new
4 IsDeleted: false, // Flag to indicate if the record is deleted
5 Id : 'a50TC00000014j8YAA', // Record id
6 cgcloud__Tactic__c: 'a37TC00000014j8YAA', // Record attribute.
7 // All Tactic condition creation definition record fields will be present as attributes
8 ...
9 },
10 ...
11]);setTacticField
API バージョン
55
シグネチャー
setTacticField(tacticId, field, value)
実装例
1component.setTacticField(
2 'a37TC00000014j8YAA', // Tactic field to set
3 'cgcloud__Comment__c', // Field name
4 'Sample Tactic' // value
5);setTacticFunds
API バージョン
55
シグネチャー
setTacticFunds(tacticFunds)
実装例
1component.setTacticFunds(
2 [ // An array of objects
3 {
4 IsNew: false, // Flag to indicate if the record is new
5 IsDeleted: false, // Flag to indicate if the record is deleted
6 Id : 'a38TC00000014j8YAA', // Record id
7 cgcloud__Fund__c: 'a39TC00000014j8YAA', // Record attribute. Reference to the Fund__c record
8 cgcloud__Tactic__c: 'a37TC00000014j8YAA', // Record attribute. Reference to the Tactic__c record
9 // All Tactic Fund record fields will be present as attributes
10 ...
11 },
12 ...
13]);getLevelNames
API バージョン
58.0
署名
getLevelNames()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3// Correct Scenario
4api.getProperty('calculationStatus'); // 'VALID'
5
6api.getLevelNames()
7 .then((levels) => {
8 console.log(levels); // ["Tactic", "Category", "Brand", "Product"]
9 });getKPISubsets
API バージョン
58.0
署名
getKPISubsets()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2// Correct Scenario
3api.getProperty('calculationStatus'); // 'VALID'
4
5api.getKPISubsets()
6 .then((subsets) => {
7 console.log(subsets); // ["Planning", "VPC", "SPC", "PromoUI", …]
8 });getKPIs
API バージョン
58.0
署名
getKPIs()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3// Correct Scenario
4api.getProperty('calculationStatus'); // 'VALID'
5
6api.getKPIs()
7 .then((kpis) => {
8 // 0
9 console.log(kpis[0].id); // "0"
10 console.log(kpis[0].name); // "BasePrice"
11 console.log(kpis[0].kpitype); // "promotion"
12 console.log(kpis[0].skipped); // ["Tactic"]
13 console.log(kpis[0].type); // "read"
14 console.log(kpis[0].valuetype); // "Price"
15 });getPeriods
API バージョン
58.0
署名
getPeriods()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3// Correct Scenario
4api.getProperty('calculationStatus'); // 'VALID'
5
6api.getPeriods()
7 .then((periods) => {
8 // 0
9 console.log(periods[0].id); // "0"
10 console.log(periods[0].name); // "AP_LBL_TOTAL" (label of the period)
11 console.log(periods[0].periodtype); // "Total"
12 console.log(periods[0].dateFrom); // null
13 console.log(periods[0].dateThru); // null
14 // 1
15 console.log(periods[1].id); // 1
16 console.log(periods[1].name); // "36/2022" // label in case of label is specified alternativly it returns the ....
17 console.log(periods[1].periodtype); // "Week"
18 console.log(periods[1].dateFrom); // 1661731200000 timestamp
19 console.log(periods[1].dateThru); // 1662249600000 timestamp
20 });getPeriodTypes
API バージョン
58.0
署名
getPeriodTypes()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3// Correct Scenario
4api.getProperty('calculationStatus'); // 'VALID'
5
6api.getPeriodTypes()
7 .then((periodTypes) => {
8 console.log(periodTypes); // ["Total", "Week"]
9 });predictUplift
API バージョン
58.0
署名
predictUplift()
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3
4api.predictUplift()
5 .then(() => {
6 // Uplift Prediction success
7 })
8 .catch((error) => {
9 console.log(error.message); // error message
10 });exportKPIs
API バージョン
58.0
署名
exportKPIs(options)
プロパティ
| 名前 | 型 | 説明 | 必須か省略可能 |
|---|---|---|---|
| options.subsets | List<String> | データを取得するために読み込まれた KPI サブセットのリスト。 getKPISubsets() メソッドを使用して、読み込まれたサブセットのリストを取得できます。 |
必須 |
| options.levels | List<String> | データを取得するために読み込まれたレベルのリスト。 getLevelNames() メソッドを使用して、読み込まれたレベルのリストを取得できます。 |
省略可能 |
| options.periods | List<String> | データを取得するために読み込まれた期間種別のリスト。 getPeriodTypes() メソッドを使用して、読み込まれた期間種別のリストを取得できます。 |
省略可能 |
| options.format | List<String> | 返される応答の形式。 可能な形式は次のとおりです。
デフォルト形式は JSON です。 |
省略可能 |
実装例
1const api = this.template.querySelector('cgcloud-tpm-promotion');
2
3// Export options, the possible values can be extracted using
4// the other described methods
5const exportOptions = {
6 subsets: ["Planning"], // Subsets to request data
7 periods: [
8 "Total",
9 "Week"
10 ],
11 levels: [
12 "Total",
13 "Category",
14 "Product"
15 ],
16 format: "json"
17};
18
19// Correct Scenario
20api.getProperty('calculationStatus'); // 'VALID'
21
22api.exportKPIs(exportOptions)
23 .then((data) => {
24 // Example response as CSV
25 //
26 // kpiName,Category,Product,AP_LBL_TOTAL,03/2022,04/2022
27 // SampleKPI1,,,246,123,123
28 // SampleKPI1,01tTC0000000001AAA,,246,123,123
29 // SampleKPI1,01tTC0000000001AAA,01tTC0000000002AAA,246,123,123
30 // SampleKPI2,,,1974,987,987
31 // SampleKPI2,01tTC0000000001AAA,,1974,987,987
32 // SampleKPI2,01tTC0000000001AAA,01tTC0000000002AAA,1974,987,987
33
34 // Example response as JSON
35 //
36 // [{
37 // kpiName: "SampleKPI1",
38 // Category: null,
39 // Product: null,
40 // AP_LBL_TOTAL: 246,
41 // "03/2022": 123,
42 // "04/2022": 123
43 // }, {
44 // kpiName: "SampleKPI1",
45 // Category: "01tTC0000000001AAA",
46 // Product: null,
47 // AP_LBL_TOTAL: 246,
48 // "03/2022": 123,
49 // "04/2022": 123
50 // },{
51 // kpiName: "SampleKPI1",
52 // Category: "01tTC0000000001AAA",
53 // Product: "01tTC0000000002AAA",
54 // AP_LBL_TOTAL: 246,
55 // "03/2022": 123,
56 // "04/2022": 123
57 // },{
58 // kpiName: "SampleKPI2",
59 // Category: null,
60 // Product: null,
61 // AP_LBL_TOTAL: 1974,
62 // "03/2022": 987,
63 // "04/2022": 987
64 // },{
65 // kpiName: "SampleKPI2",
66 // Category: "01tTC0000000001AAA",
67 // Product: null,
68 // AP_LBL_TOTAL: 1974,
69 // "03/2022": 987,
70 // "04/2022": 987
71 // },{
72 // kpiName: "SampleKPI2",
73 // Category: "01tTC0000000001AAA",
74 // Product: "01tTC0000000002AAA",
75 // AP_LBL_TOTAL: 1974,
76 // "03/2022": 987,
77 // "04/2022": 987
78 // }]
79
80
81 // We can access the properties on the result:
82 const firstRecord = data[0];
83
84 console.log(firstRecord["kpiName"]); // "SampleKPI1"
85 // Since we request the total period,
86 // we can read the total period value
87 console.log(firstRecord["AP_LBL_TOTAL"]); // 246
88 // We can also read specific periods information
89 console.log(firstRecord["03/2022"]); // 123
90 // We can also know which level the row references
91 console.log(firstRecord["Category"]); // null
92 console.log(firstRecord["Product"]); // null
93 // Since Category is null, it means this data row
94 // represents the total value for KPI "SampleKPI1"
95
96 // For last record
97 const lastRecord = data[data.length - 1];
98
99 console.log(lastRecord["kpiName"]); // "SampleKPI2"
100 // Since we request the total period,
101 // we can read the total period value
102 console.log(lastRecord["AP_LBL_TOTAL"]); // 1974
103 // We can also read specific periods information
104 console.log(lastRecord["03/2022"]); // 987
105 // We can also know which level the row references
106 console.log(lastRecord["Category"]); // "01tTC0000000001AAA"
107 console.log(lastRecord["Product"]); // "01tTC0000000002AAA"
108 // Since Product is not null, it means this data row
109 // represents the value for KPI "SampleKPI2" for that
110 // specific product
111 });