如何更改Crystal Reports中字段的排序顺序?

时间:2015-04-09 12:52:27

标签: sorting crystal-reports report sap

我在Crystal中创建了一个报告,按产品按位置列出价格。产品分为不同类别。该查询基于Microsoft SQL Server。报表用户希望按照自定义顺序生成产品,我可以将其构建到查询中,但不会反映在Crystal中的数据库/公式字段中。我想要的是[由于是新的而无法发布图片] ...... 按产品类型分组,按产品类型分组,按产品列出顶部位置,按位置列出每种产品的价格......但我需要按顺序生产产品:8,3,5,9 ...等

如何按此自定义订单排序?在查询表单中,我只是对产品进行硬编码(暂时,这只会是20项左右),但该顺序不会延续到报表中,因为我无法按其他字段对字段进行排序。帮助

后面的查询没有排序。我使用CASE WHEN ProductID = X THEN Y对它进行了排序,最后添加了一个ORDER BY。这在SQL服务器中有效,但在Crystal上无效。

DECLARE @Customer AS nvarchar(10)
SET @Customer ='99999'       'This is changed to {Customer} form on Crystal.

SELECT CustData.Name + ' (' + CustData.CustomerID + ')' AS Customer
,CASE WHEN LocatInv.LocReg1 = '' THEN 101 ELSE 0 END AS LocReg
,ISNULL(Syc.Description,'') Type
,LocatInv.Description + ' (' + RIGHT(LocatInv.LocationID, 2) + ')'
 AS Location
,ProductF.Description + ' (' + ProductF.ProductID + ')' AS Product
,PricingI.Price1 AS Price, ProductF.Unit

FROM LocatInv WITH (NOLOCK)

INNER JOIN LocatProd ON LocatInv.LocationID = LocatProd.LocationID
INNER JOIN ProductF ON ProductF.ProductID = LocatProd.ProductID
INNER JOIN PricingI ON PricingI.LocationID = LocatProd.LocationID
 AND PricingI.ProductID = LocatProd.ProductID
INNER JOIN CustData ON CustData.PriceListID = PricingI.PriceListID
LEFT JOIN (select DISTINCT Syclass.ItemID, Syclass.Description
 FROM Syclass WITH (NOLOCK) WHERE Syclass.ClassID='CLASSPR3') Syc
ON ProductF.ProductClass3 = Syc.ItemID
WHERE LocatProd.Active = 'A' AND CustData.CustomerID=@Customer
 AND ProductF.UserField1 = 'A'

1 个答案:

答案 0 :(得分:0)

实际上一张图片有助于回答..但会尝试回答

如果您已根据产品进行分组,那么您将转到更改组,然后转到选项卡自定义...在此提及您要如何显示的订单