[英]Crystal Reports - Sorting two different date fields chronologically
I've got two date fields from two tables and I'm trying to show receipts of POs in line with work order consumption sorted chronologically. 我有两个表中的两个日期字段,我试图显示按工作时间顺序排序的PO的收货。
Is there any way to sort two date fields together? 有什么办法可以将两个日期字段一起排序?
For instance: 例如:
1/1/14 work order date
1/5/14 work order date
1/7/14 PO receipt date
1/9/14 work order date
1/20/14 work order date
The two fields are 'duedate' from table 'porel' and 'reqdate' from table 'jobmtl' 这两个字段是表'porel'的'duedate'和表'jobmtl'的'reqdate'
Usually the simplest solution in such cases is to perform the ordering at the server side (eg using SQL Server stored procedure, Access query, etc.), and then use the stored procedure or query as the source for the data. 通常,在这种情况下,最简单的解决方案是在服务器端执行排序(例如,使用SQL Server存储过程,Access查询等),然后使用存储过程或查询作为数据源。
An alternative that I read about is to create global variables in the report, assign your dates values to these variables using 'WhilePrintingRecords;' 我读过的另一种方法是在报表中创建全局变量,并使用“ WhilePrintingRecords;”将日期值分配给这些变量。 in formula fields, and using these variables that then does the actual reporting for you.
在公式字段中,然后使用这些变量为您执行实际报告。
Slightly complicated. 有点复杂。
Another solution which I am not sure if applies to you is : 我不确定是否适用于您的另一种解决方案是:
Let us know how it goes. 让我们知道怎么回事。
you should create a formula saying 您应该创建一个公式说
if (table1.duedate = null) then
{table2.duedate}
else
{table1.duedate}
Then sort on this formula. 然后对这个公式进行排序。 Check the syntax yourself.
自己检查语法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.