简体   繁体   English

Crystal Reports日期和字符串的最大值

[英]Crystal Reports Maximum for date and string

I'm having some trouble with a report I am building. 我在撰写报告时遇到麻烦。

table1 is a main table that has information like dates and integers. table1是一个主表,具有诸如日期和整数之类的信息。 table2 is the look up table for table1 which is linked by the integar to table 2 ID, which gives the value of the table1 integar. table2是table1的查找表,该表通过整数与表2 ID链接,表ID提供了table1整数的值。

table1 has data such as: 1/1/2018 - 1 2/1/2018 - 2 table1具有以下数据:1/1/2018-1 2/1/2018-2

table2 has data such as 1 = Active 2 = Inactive table2包含以下数据,例如1 =活动2 =不活动

So the goal of this report is to find the most recent status. 因此,此报告的目标是找到最新状态。 i have my select expert group as table1.date = maximum({table1.date}, {@group}) and my select expert record as table2.status = "Active". 我将我的选择专家组设为table1.date = maximum({table1.date},{@group}),将我的选择专家记录设为table2.status =“有效”。

What the report pulls is the most recent "Active" status. 该报告提取的是最新的“活动”状态。 I need it to only pull the "Active" status, if that is the most recent status and not print the "Inactive" ones. 我需要它仅拉出“活动”状态(如果这是最新状态)而不打印“非活动”状态。

Create a formula called {@Date_And_Status} that combines the Date and the Status: 创建一个名为{@Date_And_Status}的公式,该公式结合了日期和状态:

ToText({table1.date}, "yyyyMMdd") & {table2.status}

In your Group Selection formula, use: 在“组选择”公式中,使用:

maximum({@Date_And_Status}, {@group}) = ToText(maximum({table1.date}, {@group}), "yyyyMMdd") & "Active"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM