简体   繁体   中英

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. I don't want to SUM() anything. I don't want to AVG() anything.

How can I display the value of Col2 (def) in a textbox.

  • Fields!Col1.Value throws an error
  • Lookup() throws an error.
=First(Fields!Col2.Value, "DatasetName")

SSRS expects a dataset to be a set (or to put it another way, it expects multiple rows). 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; I recommend the First function for clarity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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