0
votes

I am trying to call barcode by using Neodynamic Barcode generator. But I have this error: value expression for the image 'Barcode' refers directly to the field 'x' without specifying a dataset aggregate.When the report contains multiple datasets, field rreference outside of a data region must be contained within aggreate functions which specify a dataset scope. How to define dataset aggregate in this scenario?

My expression for barcode is: =Code.GetBarcode(Fields!ID.Value,"Dataset")

1

1 Answers

0
votes

I assume you are running this in a report item that is not bound to a dataset - as something like a tablix normally is - which is why you have to specify your dataset name. Because any non-aggregate function you try to apply within an SSRS expression has to be applied to a single value, you need to be more specific than just the field and dataset name; you need to include which row you are applying to function to.

This is normally handled for you either by using an aggregate function - such as sum or min or max - which defaults to 'every row in the specified column' or by being applied in the context of something like a chart or a table, which is running through the rows of the dataset one by one.

As you are doing neither, you need to specify a row. If your dataset only has the one row you can use =Code.GetBarcode(first(Fields!ID.Value,"Dataset")) which will only return the value in the first row of the dataset. If you have more than one row and you would like to apply this function to each row you will need to add a tablix and enter your expression in the Details row.