有没有办法按值列表过滤 Salesforce 报告?

发布于 2024-12-09 07:15:53 字数 949 浏览 1 评论 0原文

好的,所以我想要一个不需要最终用户了解有关编写和自定义报告或记住字段值的所有信息的报告。我最终希望用户能够在我创建的顶点页面上使用预先填充的基于 SelectList 的过滤器集合来过滤他们的报告。

到目前为止,我已经能够按每个字段的一个值进行过滤:

  1. 创建帐户报告
  2. 为BillingState Equals blank添加过滤器(这是过滤器#1) ,或索引 0)
  3. 创建带有 SelectList 的页面,并使用控制器用状态列表填充它
  4. 在页面上创建 CommandButton 并使用 PageReference 对象重定向到报表
  5. 在报表 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:

  1. Create an Account report
  2. Add a filter for BillingState Equals blank (This is filter #1, or index 0)
  3. Create a Page with a SelectList and use a Controller to populate it with a list of States
  4. Create a CommandButton on the page and use a PageReference object to redirect to the Report
  5. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吾家有女初长成 2024-12-16 07:15:53

如果我猜对了,你就快到了。

将逗号分隔的条件值添加到相应的 URL 参数中。在您的示例中,pv0 URL 参数:

/[your-report-id]?pv0=OR,FL

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:

/[your-report-id]?pv0=OR,FL
你的他你的她 2024-12-16 07:15:53

或者您可以在报表构造函数中用逗号分隔所有值。

Or you can just separate all values by commas in report constructor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文