|
|
睿智的松鼠 · HTTP客户端之Spring ...· 5 天前 · |
|
|
打盹的板栗 · 前端传递JSON数组数据到后端(解析方法)_ ...· 3 天前 · |
|
|
冷冷的草稿本 · txt文件转数组_python读取txt为数组· 2 天前 · |
|
|
淡定的盒饭 · ASP.NET 核心 Blazor ...· 2 天前 · |
|
|
傻傻的馒头 · STRING_SPLIT ...· 18 小时前 · |
|
|
绅士的闹钟 · SQLite 联接表操作 | ...· 1 年前 · |
|
|
稳重的打火机 · c - Linux Kernel ...· 1 年前 · |
|
|
长情的跑步机 · Textblob模块在集群中找不到 - ...· 2 年前 · |
|
|
灰常酷的口罩 · 大新闻:C语言二进制程序同时“跨平台”在Wi ...· 2 年前 · |
Try the below changes:
public with sharing class bikeSearchResultController { @AuraEnabled(cacheable=true) public static list<Car__c> cardetailsapexmethod(string cartypeid){ try { list<Car__c> carList = new list<Car__c>(); if(String.isEmpty(cartypeid)){ carList = [SELECT Id,Available_For_Rent__c,Build_Year__c,Car_Type__c,Name,Picture__c FROM Car__c]; else if(!String.isEmpty(cartypeid)){ carList = [SELECT Id,Available_For_Rent__c,Build_Year__c,Car_Type__c,Name,Picture__c FROM Car__c WHERE Car_Type__c=:cartypeid]; return carList; } catch (Exception e) { throw new AuraHandledException(e.getMessage());
Thanks,
Maharajan.C
All Answers
Can you try if you are able to return after assigning the response of the soql to a list variable and returning the list variable like changing the above code to below:
list<car__c> clist= [SELECT Id,Available_For_Rent__c,Build_Year__c,Car_Type__c,Name,Picture__c FROM Car__c]; return clist;
Looking forward to your response.
Thanks.
Try the below changes:
public with sharing class bikeSearchResultController { @AuraEnabled(cacheable=true) public static list<Car__c> cardetailsapexmethod(string cartypeid){ try { list<Car__c> carList = new list<Car__c>(); if(String.isEmpty(cartypeid)){ carList = [SELECT Id,Available_For_Rent__c,Build_Year__c,Car_Type__c,Name,Picture__c FROM Car__c]; else if(!String.isEmpty(cartypeid)){ carList = [SELECT Id,Available_For_Rent__c,Build_Year__c,Car_Type__c,Name,Picture__c FROM Car__c WHERE Car_Type__c=:cartypeid]; return carList; } catch (Exception e) { throw new AuraHandledException(e.getMessage());
Thanks,
Maharajan.C