You need to sign in to do that
Don't have an account?
ifthikar Ahmed 1
can a soql query return Boolean and string value ?
can a soql query return Boolean and string value ?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Not sure what is your use case but the below is possible.
i was bit confused by the below question
also can you pls explain the concept of your above example ' where you have added .FirstName after the query String firstName=[SELECT Id,FirstName FROM User LIMIT 1].FirstName; '
You can return also return a singe sObject from a SOQL.
Also the Example used by @lnalluri
The query he used will return a record from User and putting .name at the end will return FirstName From the query which is stored in the String firstname.
Let me tell by giving another example.
Suppose we have a sObject which have the folollowing fields and datatype.
sObject Name ---> Account
Field Name Datatype
Name String
Number of Employees Number
isActive Boolean
So if i want my query to return Integer then ill use .NumberofEmployees at the end of my query which is a number field.
Integer num = [SELECT ID, NumberOfEmployees FROM Account LIMIT 1].NumberOfEmployees];
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
I have gone through your query and inspected your question too.
You can return all three types of datatype i.e Boolean, String, Integer from a SOQL query.
The correct options for the question are-
A, C and D
(A) - Boolean
(B) - String
(c) - Integer
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com