简体   繁体   English

SSRS从数据集中获取列值

[英]SSRS Get a column value from a dataset

I want to do something so simple that there is no reference to it on the internet! 我想做的事情很简单,以至于互联网上都没有引用它!

I have a dataset that returns a singe row: 我有一个返回单行的数据集:

Col1   Col2   Col3  Col3...
abc    def    ghi   zzz...

I just want to display the value of Col2 (def) in a textbox. 我只想在文本框中显示Col2(def)的值。 I don't want to SUM() anything. 我不想对SUM()进行任何操作。 I don't want to AVG() anything. 我什么都不想要AVG()。

How can I display the value of Col2 (def) in a textbox. 如何在文本框中显示Col2(def)的值。

  • Fields!Col1.Value throws an error Fields!Col1.Value引发错误
  • Lookup() throws an error. Lookup()引发错误。
=First(Fields!Col2.Value, "DatasetName")

SSRS expects a dataset to be a set (or to put it another way, it expects multiple rows). SSRS期望数据集是一个集合(或者换句话说,它期望多行)。 A textbox is meant to hold a single value, so it doesn't know how to put multiple values in a single-value container. 文本框用于保存单个值,因此它不知道如何在单个值容器中放置多个值。 You have to use some sort of aggregate function to tell SSRS that this will only be one value; 您必须使用某种聚合函数来告诉SSRS,这将仅仅是一个值。 I recommend the First function for clarity. 为了清晰起见,我建议使用First函数。

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

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