0
votes

I using Salesforce (apex), i need Query that will select values from table and return them in toLowerCase.

some think like this:

//only example (not working code)

 for(Users user:[select Name.toLowerCase(),LastName.toLowerCase() from Users ] )
 {  
  //code....
 }

For example if i have table Users with

Name | LastName

Boby | Testovich1

Dany | Testovich2

Ron  | Testovich3

Query need to return me all values with toLowerCase:

boby testovich1,dany testovich2,ron testovich3

I can do this like this

  for(Users user:[select Name,LastName from Users ] )
     {  
     string UserName=user.Name.toLowerCase();
     }

but is there a way to to this with querying?

Is there a way to do this in Salesforce (apex) Query ?

1
This questions are both my.Here i need to return all values with LowerCase,and in the second i need to make where statement by LowerCase that mean if i looking for 'boby' in table and there is 'BOBY' in the table i still will find it.i don't understand why you decide that this is the same question.Vladimir Potapov

1 Answers

2
votes

No you can't transform the return value to lower case in the query, you'll need to do it after you've gotten the query results.

One alternative is to add a formula field that returns the lower case value and query that instead.