Salesforce(apex) Query return values with toLowerCase

£可爱£侵袭症+ 提交于 2020-01-07 03:46:29

问题


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:


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.



来源:https://stackoverflow.com/questions/39557672/salesforceapex-query-return-values-with-tolowercase

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!