How do I reference a particular row in a report's dataset.

I'm looking for a way to display first and last entries in a report header, similar to a name range for a directory. list expressions that would allow this, but it only offers the absolute first and absolute last entries.  I'm trying to display the range for each page. (Ex: P1 A - E, P2 E - G, P3 H - MI, etc.)

I am using VB.NET through VS 2010 and an rdlc local report (not Crystal Reports).  I've tried referencing a function through the report object's expression, but got an 'not declared' error.  I've tried adding custom code to the report, as per  I can't manage to find a way to reference a specific row in the dataset from the report. (OpenForms(formname), frmFormName.DataTable, Dataset.Item() all give me the same 'not declared' error.)

Is there a way to generate the string I'm attempting either automatically or manually?  (If only manually, I can determine which records to use based on the page number.)
Who is Participating?
puffdaddy411Connect With a Mentor Commented:
Ok I've found something and got it to work on a dummy report I just created.  If we were using the dictionary example, we would have the name of the "Object" to be defined in a column (or even simply the first letter of the item).  In this case we will use "Object" as the column name.  Its first value would be "Aardvark", right?  =D
Anyway, if our dictionary was in a table (default name of "table1") in the report body, use the following line to show the first item on the current page in your page header.

The same can be done for the last item.
The only problem I see is that I got an error when I tried to add references to two report items in the same textbox in the header.  That apparently is not allowed.  So you could do some formatting with 2-3 separate textboxes to get the result you want.  Make sense?
P1: Aardvark - Bat
P1: A - B
I dont know the RDLC product.

In Crystal I would do this with formulas int he page header and footer.
The page header formula would save the value you need from the first record on the page.
The page footer formula wuld do the same for the record it has and then display the value you want.

So you have a column that has something like A-Z in the rows and you are breaking this master datatable into sub tables or lists on different pages such as you listed (P1 A - E, P2 E - G, P3 H - MI)?
Have you tried to create your needed strings and pass them to your report as parameters?  For some of these specific needs, I ususally pass parameters because it is easier to generate the result in code rather than on the rdlc report.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

icegator2Author Commented:
mlmcc:  There are 'First' and 'Last' expressions, but they are not page specific.  I can't access the dataset from the header or footer without using from a pre-defined set of expressions, so (Fields!Item.Value, 'Dataset') causes a build error instead of producing whatever happens to be the current dataset row. (i.e. first for page one and first for page twelve will be the same regardless of what actually prints on the page.)

puffdaddy411: I'm not breaking a master table into sub-tables.  Imagine if you printed a dictionary as a single report.  The entries are a continuous list, but at the top of each page, the entry range changes based on the page.
   Previously, I printed an odd page layout as a single report, followed by an even page layout as a single report, and so on.  The parameter 'NameRange' worked then, but it didn't allow me to duplex print the report.  I have since figured out how to control the layout for each page style in a single report.  Unfortunately, the parameter is no longer correct.  I tried to re-assign the parameter during 'QueryPageSettings', but I don't have access to the page number of the report.
   I toyed with the idea of using several 'NameRange' parameters, passing all the values to the report and controlling visibility via page number.  While I control records per page, I have no way of anticipating total pages, thus knowing how many parameters to put on the report.  This would probably mean adding an unrealistically large number of parameters and hoping the users never try to print more pages that that.
Sorry for the confusion here but I'm trying to get the details.  I got your dictionary example.  What type of object(s) are you placing on your report to display this information from your dataset?
icegator2Author Commented:
In the header, I'm using a textbox.  In the body, a table.
icegator2Author Commented:
So close.  Those expressions work great.  For some reason, it works fine on page one, but on page two (last page in this case), it makes itself and almost everything else in the header (not all though) invisible.

Now that you've pointed me in the right direction, I'll keep tweaking this and see if I can fix it.

Thanks a lot.
I'm not in front of my PC, but try to trim() it. It sounds like the textbox is auto sizing due to extra blanks or something.
Did the Trim() work for you?  I tested my make-shift report and did not have the same issue even without the Trim().
icegator2Author Commented:
I had "CanGrow = False", so the "Trim()" wasn't necessary.  A partial solution was that when designing, I put the start and end entry textboxes in a rectangle, fit the rectangle to the size of the two boxes, then used the location property to move the rectangle.  This relocated the rectangle, but left the textboxes where they were relative to the report, not the rectangle (a weird quirk, to say the least).  When the report printed, it pushed the other headings below the textboxes and off the header, making it look as if everything disappeared.

I finally got it.  I was also referencing an odd page item for the heading on even pages and getting errors.  I actually figured this out while putting code in here.

Where did you find the "ReportItem()" expression?  I've been having trouble finding good resources for working with local reports.
To be honest, I found "ReportItems()" in a random thread about a completely different subject.  I then researched it on MSDN.
I started playing with it and came up with what you needed.  The only resource, other than EE =D , is
Good Luck!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.