You need to sign in to do that
Don't have an account?

how to get SOQL query output in different rows
Hello All,
I've a situation in where I have to get the SOQL query output in all different rows. So how can we do it ?
Can we use <br> tag in apex class?
I'm use to apex and I dont know how to do that. Can anyone please explain with some examples and codes.
Regards,
Hardik B.
I've a situation in where I have to get the SOQL query output in all different rows. So how can we do it ?
Can we use <br> tag in apex class?
I'm use to apex and I dont know how to do that. Can anyone please explain with some examples and codes.
Regards,
Hardik B.
Actually, I want the output of the query elements, Like this :
Account acc = [Select Name,
Phone,
Industry,
Description
From Account];
So how all the fileds are written the output should be the same way.
Thanks,
Hardik B.
As when you query on any sObject it returns List of the sObject
which is like this
List<Account> allAcc=[select name, Phone, Industry from Account];
as it is returning list so you can iterate the list through for each loop means you are accessing each rows of the query returns
for(Account acc: allAcc){
System.debug(acc.Name+' '+acc.Industry);
}
If the soql query return only one row then it automatically get type cast into returned sObject
Account acc=[select name, Industry from Account limit 1];// this query return only one row.
Thanks
Saket Sharma
This is working by debug, but it is not actually fiving me the output as desired. Also to make more clear I want this to work through @RemoteAction. I have already done this through Reactjs codes. but how can I use it through @RemoteAction to get the desired output as earlier.
Thanks,
Hardik B.
@RemoteAction is asyncrhronous process so it will run this method only when resource will be available try using any synchronous method like action function if you want to call controller method from javascript ,to see the output in real time. As Asynchronous methods are not executed in real time so it will not refresh the view state of the page.
Thanks
Saket Sharma
But how can I use action function in apex class. I know we can do that through VF but is there any workaround to do in apex class ?
Thanks,
Hardik B.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_RemoteAction.htm
If you are not using vf then I dont y u r using @remoteAction
if you want some asynchronous call there are other options available like future methods,etc.