Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LWLeaseCountExtensionsController {
- @AuraEnabled(cacheable=true)
- public static List<Account> getAccount(String AccId) {
- return [SELECT Id,LeaseWaveID__c, LW_Customer_ID__c, LW_Fleet_ID__c, LW_Account_ID__c, LW_SubAccount_ID__c from Account where Id=:AccId Limit 1];
- }
- @AuraEnabled()
- public integer lc;
- /*This was the original code that I tried first, but since it didn't work with a return type of Integer, I commented out the below method and created the next method which take a list of Integer as return type */
- @AuraEnabled(cacheable=true)
- public static Integer getLeaseCount(string LeaseWaveID) {
- Integer lc = !string.isblank(LeaseWaveID) ? [SELECT COUNT() FROM DW_oData_vw_sf_Units__x WHERE Lease__c = TRUE AND LeasewaveId__c =:LeaseWaveID] : -1;
- @AuraEnabled(cacheable=true)
- public static List<Integer> getLeaseCount(string LeaseWaveID) {
- //List<integer> lc = !string.isblank(LeaseWaveID) ? [SELECT COUNT() FROM DW_oData_vw_sf_Units__x WHERE Lease__c = TRUE AND LeasewaveId__c =:LeaseWaveID] : -1;
- List<integer> lc;
- Integer i;
- if(LeaseWaveID!=null)
- i=[SELECT COUNT() FROM DW_oData_vw_sf_Units__x WHERE Lease__c = TRUE AND LeasewaveId__c =:LeaseWaveID];
- else
- i=-1;
- lc.add(i);
- system.debug('leaseWaveID1--'+lc);
- return lc;
- }
- }
- import { LightningElement,api,wire,track } from 'lwc';
- //import { getSObjectValue } from '@salesforce/apex';
- import getAccount from '@salesforce/apex/LWLeaseCountExtensionsController.getAccount';
- import Account_LeaseWaveId from '@salesforce/schema/Account.LeaseWaveID__c';
- import getLeaseCount from '@salesforce/apex/LWLeaseCountExtensionsController.getLeaseCount';
- export default class TestLWLeaseCountwebComponent extends LightningElement {
- @api recordId;
- @track getLeaseCount;
- @api totalLC;
- @wire(getAccount,{AccId:'$recordId' })
- accounts;
- @wire(getLeaseCount, { LeaseWaveID: Account_LeaseWaveId})
- odata;
- totalLC = JSON.stringify(this.lc);
- }
- <template>
- <lightning-card title="LWCount" icon-name="custom:custom63">
- <div class="boarder">
- <!-- <p class=”slds-m-bottom_small”>
- <lightning-button label=”LoadContacts” onclick={handleLoad}></lightning-button>
- </p> -->
- <template if:true={accounts.data}>
- {LeaseWaveID}
- </template>
- {totalLC}
- <template if:true={odata.data}></template>
- </div>
- </lightning-card>
- </template>
- <template>
- <div class="boarder">
- <template if:true={accounts.data}>
- <ui>
- <template for:each={accounts.data} for:item="acc">
- <li key={acc.Id}>{acc.LeaseWaveID__c}</li>
- </template>
- </ui>
- </template>
- </div>
- </template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement