Salesforce(apex) 使用 toLowerCase 查询返回值 [英] Salesforce(apex) Query return values with toLowerCase
问题描述
我使用 Salesforce (apex),我需要从表中选择值并将它们返回到 toLowerCase 的查询.
I using Salesforce (apex), i need Query that will select values from table and return them in toLowerCase.
有些人是这样想的:
//仅示例(非工作代码)
//only example (not working code)
for(Users user:[select Name.toLowerCase(),LastName.toLowerCase() from Users ] )
{
//code....
}
例如,如果我有
姓名 |姓氏
Boby | Testovich1
Dany | Testovich2
Ron | Testovich3
查询需要使用 toLowerCase 返回所有值:
Query need to return me all values with toLowerCase:
bby testovich1,dany testovich2,rontestovich3
boby testovich1,dany testovich2,ron testovich3
我可以这样做
for(Users user:[select Name,LastName from Users ] )
{
string UserName=user.Name.toLowerCase();
}
但是有没有办法通过查询来解决这个问题?
but is there a way to to this with querying?
有没有办法在 Salesforce (apex) 查询中做到这一点?
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屋!