简体   繁体   English

SSRS 2008-如何保持SAME顺序输入要在报告中反映的参数

[英]SSRS 2008 - How keep the SAME order enter in the parameter to be reflected in the report

I am working on a SSRS 2008 Report that when entering a list of ITEM numbers in a multiple data type parameter will return the Item Number, UPC, Description, and Item Status. 我正在处理SSRS 2008报告,当在多种数据类型参数中输入ITEM号列表时,将返回“项目号”,“ UPC”,“描述”和“项目状态”。

It works. 有用。 But my problem is that it sorts my data in my report. 但是我的问题是它对我的报告中的数据进行排序。 Example. 例。 If I enter the following Item Numbers in the parameter: ZZZ DDD AAA HHH 如果我在参数中输入以下项目编号:ZZZ DDD AAA HHH

My report shows the Data alphabetic as: AAA DDD HHH ZZZ 我的报告将数据按字母顺序显示为:AAA DDD HHH ZZZ

I want my data to be displayed in the order of the ITEM Number how I enter them. 我希望我的数据按照输入项目的顺序显示。

I have One Data Set: SELECT ItemNo, UPC, Description, Status FROM Product WHERE ItemNo IN (@ITEM) 我有一个数据集:SELECT产品编号,UPC,描述,产品状态(来自产品WHERE产品编号IN(@ITEM))

I have One Parameter: @ITEM Datatype: Text Allow multiple values 我有一个参数:@ITEM数据类型:文本允许多个值

Please Help! 请帮忙!

You need to parse the string into a table and then set an order to the table you've created. 您需要将字符串解析为表格,然后为创建的表格设置顺序。 Then you have something to sort by. 然后,您可以进行排序。

First - create a function that you can call in your sp. 首先-创建一个可以在sp中调用的函数。 (the answer to this question gives you exactly what you need) 问题的答案将为您提供所需的确切信息)

then, in your query you can use the function just like a table. 然后,您可以在查询中像使用表一样使用该函数。

DECLARE @x VARCHAR(100)
SELECT @x = 'ZZZ DDD AAA HHH'

SELECT * FROM f_split(@x,' ') param
WHERE param.seq > 1
ORDER BY param.val

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

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