Salesforce(apex)使用toLowerCase查询返回值 [英] Salesforce(apex) Query return values with toLowerCase
问题描述
我使用Salesforce(apex),我需要从表中选择值并将其返回到LowerCase的查询.
有人这样想:
//仅示例(无效代码)
for(Users user:[select Name.toLowerCase(),LastName.toLowerCase() from Users ] )
{
//code....
}
例如,如果我的表Users带有
名称|姓氏
Boby | Testovich1
Dany | Testovich2
Ron | Testovich3
查询需要使用toLowerCase返回所有值:
b oby t estovich1, d 任何 t estovich2, r t estovich3
我可以这样做
for(Users user:[select Name,LastName from Users ] )
{
string UserName=user.Name.toLowerCase();
}
但是有没有办法通过查询来做到这一点?
在Salesforce(apex)查询中是否可以做到这一点?
不,您不能在查询中将返回值转换为小写,获得查询结果后就需要这样做./p>
一种选择是添加一个返回小写值的公式字段,然后查询该字段.
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 ?
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.
这篇关于Salesforce(apex)使用toLowerCase查询返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!