Helen54999


Is there a maximum number of characters in an expression

thx

Helen





Re: Maximum length of an expression

Robert Bruckner MSFT


There is no hard limit on the length of a single expression.

But even if there were, you could always convert that expression into a custom code or custom assembly function and then simply call the function from the original expression.

-- Robert







Re: Maximum length of an expression

Helen

If only that were true! Alas, my longest expressions are to provide a sub-title built of the selected values of a pile of multi-select (and other) parameters, and these require the use of such functions as Count, which cannot be called from code behind.

Debugging these things is a painful experience (as is debugging code behind) -- am I alone in wishing fervently for better debugging

Thx

Helen







Re: Maximum length of an expression

Robert Bruckner MSFT

Maybe you can post your expression here and I may have suggestions of how to refactor it.

-- Robert






Re: Maximum length of an expression

Helen

Here ya go (one of the shorter ones!):

=iif(Parameters!DepartmentIDs.Count = count(Fields!DepartmentID.Value, "Departments"),"All Departments", "Departments: " + join(Parameters!DepartmentIDs.Label,", ")) + "; " + iif(Parameters!EmployeeTypeIDs.Count = count(Fields!EmployeeTypeID.Value, "EmployeeTypes"),"All Employee Types", "Employee Types: " + join(Parameters!EmployeeTypeIDs.Label,", ")) + "; " + iif(Parameters!JobTitleIDs.Count = count(Fields!JobTitleID.Value, "JobTitles"),"All Job Titles", "Job Titles: " + join(Parameters!JobTitleIDs.Label,", ")) + "; " + iif(Parameters!VenueIDs.Count = count(Fields!VenueID.Value, "Venues"),"All Venues", "Venue 1: " + join(Parameters!VenueIDs.Label,", ")) + iif(IsNothing(Parameters!LastName.Value), "", "; Last Name Like " + Parameters!LastName.Value) + iif(IsNothing(Parameters!AgreementStartDate.Value), "", "; Agreement Date Between " + Parameters!AgreementStartDate.Value + " and " + Parameters!AgreementEndDate.Value) + iif(IsNothing(Parameters!JobStartDate.Value), "", "; Job Start Date Between " + Parameters!JobStartDate.Value + " and " + Parameters!JobEndDate.Value)

I realize that I could shorten this beast by creating a function to build the label strings, one of the parameters being the count of the fields (since there appears to be no way of calling Count from Code behind), so I would not have to repeat the logic for each multi-select parameter.

The way I debug these things is to build them section by section, using notepad to add each section and copying it to the expression, then going to preview mode to see if it works. This works (slowly!) unless there is a little bombshell awaiting me -- the report prints fine from Report Designer preview mode, but chokes when I deploy it and open it from Report Manager -- happily this doesn't happen too often.