Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Umekitaforce 20190108

106 views

Published on

Lightning Web Component & Big Objects

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Umekitaforce 20190108

  1. 1. Lightning Web Component & Big Objects @Umekitaforce 2019年1月8日 稲葉 洋幸 | Platform Specialist & Einstein Pathfinder | Salesforce
  2. 2. Looking Forward Statement Statement under the Private Securities Litigation Reform Act of 1995 This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  3. 3. 今日 内容 両方ともに初級者向けです 1.Lightning Web Component 1-1.誕生 背景 1-2.読み解くにあたって ポイント 1-3.まず ここから試してみる 2.Big Objects 2-1.どんなも ? 2-2.インデックスに気をつける 2-3.Platform Events と連携させた実装例
  4. 4. 1. Lightning Web Component 1-1.誕生 背景/メリット 1-2.読み解くにあたって ポイント 1-3.まず ここから試してみる
  5. 5. 1-1.誕生 背景(1/2) < 2014年頃 > < 2019年現状 > < LWC 構成 >
  6. 6. 1-1.誕生 背景 1. Compliant to web standards 2. Lightweight 3. Memory efficient 4. Fast 5. Easier to learn and Transferable knowledge < アドバンテージ >
  7. 7. 1-2.読み解くにあたって ポイント コンポーネント ファイル構成 デコレーター ①画面構成 画面に表示する項目・内容 ②ロジック記述 動き/処理 ③各種設定 どこで使えるようにするか?など ④スタイル定義 画面表示 見た目カスタマイズ ⑤SVG画像定義 アイコン情報 ⑥そ 他共通ロジック ②にインポートして使う myComponent ├──①myComponent.html ├──②myComponent.js ├──③myComponent.js-meta.xml ├──④myComponent.css ├──⑤myComponent.svg └──⑥moreSharedCode.js https://developer.salesforce.com/docs/component-library/document ation/lwc/lwc.reference_decorators 変数やメソッド 意味づけをする @api プロパティやメソッドをパブリックにする @track プライベートなプロパティで変更時 再描画をさせる @wire オブジェクト データ取得、APEX メソッドコールをできるようにする // todoItem.js import { LightningElement, api } from 'lwc'; export default class TodoItem extends LightningElement { @api itemName; }
  8. 8. 1-3.まず ここから試してみよう オンラインマニュアル Trailhead & サンプル集 https://developer.salesforce.com/docs/component-library/documentati on/lwc/lwc.get_started_introduction https://trailhead.salesforce.c om/en/content/learn/project s/quick-start-lightning-web-c omponents https://github.com/trailheada pps/lwc-recipes
  9. 9. 2. Big Objects 2-1.どんなも ? 2-2.インデックスに気をつける 2-3.Platform Events と連携させた実装例
  10. 10. 2-1.Big Objectsってどんなも ? Big Objects 1. データ たくさん(億件想定)入ります。 が、いわゆる OLTP 向きで ありません。 2. 標準・カスタムオブジェクトと比べると、できないことも 多いです。(入力規則・トリガーなど) 3. SOQL 同じように使えますが、WHERE 句を使うた めに INDEX をきちんと設計・定義する必要があり ます。
  11. 11. 2-2.インデックスに気をつける インデックス 役割・特性 DeviceID__c (Index1) LogDateTime__c (Index2) Temperature__c DEV0001 20190108090001 7 DEV0002 20190108090001 8 DEV0001 20190108090002 8 DEV0002 20190108090003 9 ■データ例 (SensorData__b) ● データを一意に特定する ● 単一もしく 複数 項目を組み 合わせて構成される(Salesforce ID 付与されない) ● SOQL WHERE 句で使われ る項目になる ● 順番を飛 した項目 みで WHERE 句によるフィルタリング できない SELECT DeviceID__c, LogDateTime__c, Temprature__c FROM SensorData__b WHERE DeviceID__c=’DEV001’ SELECT DeviceID__c, LogDateTime__c, Temprature__c FROM SensorData__b WHERE LogDateTime__c=’20190108090001’ OK NG
  12. 12. 2-3.Platform Events と連携させた実装サンプル デバイス Platform Event トリガー Big Objects レコード 詳細画面 コンポー ネント APEX クラス1 2 3 4 5
  13. 13. 2-3-① Platform Event 定義
  14. 14. trigger SensorDataReciveTrigger on SensorDataReciver__e (after insert) { List<SensorDataWithRelation__b> sdataset = new List<SensorDataWithRelation__b>(); for (SensorDataReciver__e event : Trigger.New) { SensorDataWithRelation__b sdata = new SensorDataWithRelation__b(); sdata.SensorDevice__c = event.SensorDevice__c; sdata.LogDate__c = event.LogDate__c; sdata.Temprature__c = event.Temprature__c; sdata.Pressure__c = event.Pressure__c; sdata.Humidity__c = event.Humidity__c; sdataset.add(sdata); } if (sdataset.size() > 0) { database.insertImmediate(sdataset); } } 2-3-② トリガー 実装サンプル
  15. 15. 2-3-③ Big Object 定義
  16. 16. public class DeviceLogViewerAPEXController { @AuraEnabled public static List<SensorDataWithRelation__b> getDeviceLogData(String recordId){ return [SELECT SensorDevice__c,LogDate__c,Temprature__c,Pressure__c,Humidity__c FROM SensorDataWithRelation__b WHERE SensorDevice__c=:recordId LIMIT 100]; } } 2-3-④ APEX クラス 実装サンプル
  17. 17. ■ DeviceLogViewer.cmp <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="DeviceLogViewerAPEXController" > <aura:attribute name="logData" type="Object"/> <aura:attribute name="columns" type="List"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <lightning:card title="センサーデータ(Big Object 格納 &amp; 抽出100件のみ)"> <div class="slds-m-around_small"> <lightning:datatable data="{!v.logData}" columns="{!v.columns}" keyField="LogDate__c" hideCheckboxColumn="true"/> </div> </lightning:card> </aura:component> ■ DeviceLogViewerController.js ({ doInit : function(component, event, helper) { component.set('v.columns', [ {label: '記録日時', fieldName: 'LogDate__c', type: 'text'}, {label: '気温', fieldName: 'Temprature__c', type: 'number'}, {label: '気圧', fieldName: 'Pressure__c', type: 'number'}, {label: '湿度', fieldName: 'Humidity__c', type: 'number'} ]); var action = component.get("c.getDeviceLogData"); action.setParams({ recordId: component.get('v.recordId') }); action.setCallback(this, function(ret) { var results = ret.getReturnValue(); component.set('v.logData', results); }); $A.enqueueAction(action); } }) 2-3-⑤ 表示用 Lightning Component 実装サンプル

×