我想在rails中创建带有reportkit的多列表格报告。我尝试了很多方法,但是没有找到正确的解决方案。谁能帮我吗?如何使用Reportskit制作多列表格报表?
我尝试了维度配置,但是对多列报表没有影响。然后,我在yaml文件上尝试了很多配置。这是报告包官方网站https://www.reportskit.co/。
在模型文件中,
reports_kit do
aggregation :average_time_to_publish, [:average, 'sale.created_at - posts.updated_at']
contextual_filter :for_author, ->(relation, context_params) { relation.where(sale_id: context_params[:sale_id]) }
dimension :approximate_views_count, group: 'ROUND(sale.views_count, -1)'
filter :is_published, :boolean, conditions: ->(relation) { relation.where(status: 'published') }
end
在YML文件中,
measure: sale
filters:
- key: sale_id
- key: cashier_name
- key: created_at
criteria:
operator: between
value: "-3M - now"
dimensions:
- key: sale_id
label: SALE ID
limit: 5
- key: created_at
label: CREATED AT
limit: 5
format: table
实际结果, enter image description here 预期结果, enter image description here