有没有办法按值列表过滤 Salesforce 报告?
好的,所以我想要一个不需要最终用户了解有关编写和自定义报告或记住字段值的所有信息的报告。我最终希望用户能够在我创建的顶点页面上使用预先填充的基于 SelectList 的过滤器集合来过滤他们的报告。
到目前为止,我已经能够按每个字段的一个值进行过滤:
- 创建帐户报告
- 为BillingState Equals blank添加过滤器(这是过滤器#1) ,或索引 0)
- 创建带有 SelectList 的页面,并使用控制器用状态列表填充它
- 在页面上创建 CommandButton 并使用 PageReference 对象重定向到报表
- 在报表 URL 的末尾,添加PV0 (索引 0 的参数值)= [选定状态]
所以这一切都很好 - 用户不必记住有效的字段值并弄乱报告过滤器,他们可以指向并单击内容 - 销售人员可以轻松做到这一点。
但现在我想按状态列表(或其他一些文本字段)进行过滤。我可以使用 SelectList 的多选属性轻松获取状态的 String[] 列表,但我不知道如何将其应用到报告中。在 SQL 意义上,我想向报告查询添加“State=x OR State=y OR State=Z”或“State IN (x, y, z)”where 条件。
我怎样才能做到这一点 - 通过字段的有效值列表过滤报告,并通过控制器以编程方式执行此操作?
是否有某种方法可以以编程方式动态创建临时报告?克隆“模板”报告,然后根据需要添加 OR 过滤器?
有没有办法将一组对象传递给报表?有些报告返回很多结果,所以这看起来很危险。
在进行 PageReference 重定向时,Redirect 属性指出,当该属性为 false 时,所有状态信息都将保留,但目标页面必须具有相同的控制器 - 有没有办法将控制器与报表结合使用来自定义其逻辑?
Ok, so I want to have a report that does not require the end user to know all about writing and customizing reports or memorizing field values. I ultimately want the user to be able to use a collection of prepopulated SelectList based filters on an apex page I've created to filter their report.
So far I have this as far as being able to filter by one value for each field:
- Create an Account report
- Add a filter for BillingState Equals blank (This is filter #1, or index 0)
- Create a Page with a SelectList and use a Controller to populate it with a list of States
- Create a CommandButton on the page and use a PageReference object to redirect to the Report
- At the end of the URL for the report, add pv0 (parameter value for index 0) = [selected state]
So this is all well and good - instead of having the user memorize valid field values and mess with report filters they can point and click stuff - so simple a sales person could do it.
But now I want to filter by a list of states (or some other text field). I can easily get a String[] list of states with the multiselect attribute of the SelectList, but I don't know how to go about applying it to the report. In an SQL sense I want add a "State=x OR State=y OR State=Z" or "State IN (x, y, z)" where condition to the reports query.
How could I go about doing this - filtering a report by a list of valid values for a field, and doing it programmably from a controller?
Is there some method to programmably create a temporary report on the fly? Clone a "template" report and then add OR filters as needed?
Is there a way to pass a set of objects to a report? Some reports return a lot of results, so this seems dangerous.
When doing PageReference redirection the Redirect attribute states that when it is false all the state information is retained, but the destination page must have the same controller - is there a way to use controllers with reports to customize their logic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我猜对了,你就快到了。
将逗号分隔的条件值添加到相应的 URL 参数中。在您的示例中,pv0 URL 参数:
If I get you right, you're almost there.
Add your criteria values comma separated to the appropriate URL parameter. In your example, the pv0 URL parameter:
或者您可以在报表构造函数中用逗号分隔所有值。
Or you can just separate all values by commas in report constructor.