My Problem
I have a fairly straight forward autoexec macro to perform a version control check for my split database. I have a table in the frontend called LocalVersionNumber, and a table in the backend called LiveVersionNumber. Each version number may have multiple values (ex. which version of the backend is being used, which frontend, etc). Because of this, the value in these tables are parsed via the queries __LiveVersionParser_Q and __LocalVersionParser_Q. Without going into too much wasted detail, the local version number should always be equal or greater than the live version number.
I wrote up a query that compared my local & live parsed values - and via IIF expressions, determined the logic to update or keep with current version. This test query ran without issue, but now that I've pulled the logic into a autoexec macro and I'm getting the error:
Cannot find the name '__LiveVersionParser_Q' you entered in the
expression.
I've double checked, and the table and fields are spelled correctly. I've even gone as far as to copy and paste the statement from the macro back into a query, and the query executes properly still.
The Code
(In Macro Builder not VBA - ugh)
"IF" Action
CDbl([__LiveVersionParser_Q].[DevelopmentVersion])
<=CDbl([__LocalVersionParser_Q].[DevelopmentVersion])
Then... execute my update frontend logic.
NOTE: For those asking "why use CDbl?", this is used because the version number is a text string with multiple values separated by ".". After parsing the versions, these strings are then compared by converting them to a double (using CDbl) to see which is greater.
Troubleshooting
As I stated earlier, this statement DOES work, just not in this macro. I've troubleshot it by using the following query (to keep it consistent, here is the 'design' view expression I tested rather than SQL):
Expr1: IIf(CDbl([__LiveVersionParser_Q].[DevelopmentVersion])
<=CDbl([__LocalVersionParser_Q].[DevelopmentVersion]),"OK","UPDATE")
Any suggestions? I feel like I'm missing something simple.
I have found a workaround (not a root cause & solution). If someone can provide a proper explanation of the root cause, I will gladly switch over answer credit to them!
But in the meantime, should anyone else run into a similar problem, here is my workaround:
Step 1:
As stated in my question, I have a query that runs the "IF" action perfectly fine. So I used that to output a Result field that states either "OK" or "Update".
Step 2:
I changed my autoexec macro to be as follows:
IF...
DMax("Result","__VersionControl_FinalTest")="Update"
THEN...
Run my update code.
ELSE...
CancelEvent
END IF
NOTE: I tried to use a simple statement of:
IF...
[__VersionControl].[Result] = "Update"
However, when I ran that macro, I again received the error 2482 ("cannot find the name...").
Why DMax is able to 'find' the __VersionControl_FinalTest query and the IF statement cannot, I do not know - but at least I'm back up and running.
I have the following code and I now want to only show the max or distinct values for a single field within SSRS.
=Join(LookUpSet(Fields!Baseacctnbr.Value,
Fields!Baseacctnbr.Value,
Fields!Acctnbr.Value,
"DataSet1"), ",")
Right now with this expression the code brings back all the accounts, but it brings back multiples of the same account because of the SQL query and other data that is needed. I would like to only show the MAX or Distinct values of the AcctNbr on a single field within SSRS.
Is there a way to add the MAX expression to this existing expression?
UPDATE:
When I add the SSRS Code Block found on another question, then I receive an error message that states: "Too many arguments to 'Public Shared Function RemoveDuplicates(m_Array() As Object) As String()."
Thanks.
I removed the close brace and it worked fine. I had also entered this code before your response and it worked fine since the account is actually 8 characters long.
=Join(Code.RemoveDuplicates(LookupSet(Left(Fields!BaseAcctNbr.Value, 8), Fields!BaseAcctNbr.Value, Fields!AllPhase3AcctNbrs.Value, "DataSet1")), ",")
Thanks for your help!
This is for a budgetary application developed in Access 2007, currently running 2010. The application was working fine. I identified a logic error in a query. While fixing it I realized that I could change the parameters from:
Month(budget.capture_date) = [forms]![f_budget]![tglMonth]
AND
Year(budget.capture_date) = Year([forms]![f_budget]![capture_date])
to simply:
budget.capture_date = DateSerial(Year([forms]![f_budget]![capture_date]),[forms]![f_budget]![tglMonth],1)
Should be fine right? My thought was maybe it would be slightly faster due to less function calls.
The queries worked correctly while testing and typing the parameter in manually when opening the query.
When opening the budget form via DoCmd.OpenForm with criteria, all of the subforms with the DateSerial parameter showed as blank. The field f_budget!capture_date used in the parameter did contain a value.
When opening the form manually every subform gave the following error (no error code):
This expression is typed incorrectly or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.
So, after investigation, if you open a parameter query with DateSerial and just skip through the parameters you will receive the error above. If you enter the date manually, it will work correctly. If I open the form via OpenForm with criteria, there is no error, but all the subforms are blank. From there if I change to design view and then back to form view without closing the form, the form will work perfectly. If I close the form and open it manually I will receive the above error for every subform with the DateSerial criteria.
Note that using Year() or Month() and skipping through a query's parameters will just return no results, it will not cause the error above.
This one has me stumped. I've created a new db and imported everything in it, decompiled, repaired, added the DateSerial to the parameter list of the query ect. Doesn't matter, the behavior is consistent. Anyone have any insight?
Year() and Month() functions allow to pass NULL while DateSerail require valid Integers.
So query fail to run with empty patrameters.
SQL Server 2008 R2, using BIDS to design the report.
I have a table and I am trying to only show a certain row. Maybe there are better ways to do this, but I am coming across an error with the filter expression and regardless of how I achieve my initial task, I'd like to understand the filtering.
I started with the filter expression (set to type "Integer"):
RowNumber(Nothing) = 1
This gave the error:
Cannot compare data of types System.String and System.Int32.
I found the solution to this is to change the 1 to "=1" as 1 is evaluated as a string.
So I then had:
RowNumber(Nothing) = =1
That changed nothing, I got the same error.
Then I tried to do that to the first part of the expression:
=RowNumber(Nothing) = =1
This changed the error to a deployment problem (still builds, which is frustrating):
Error pvInvalidDefinition : The definition of the report '/ReportName' is invalid.
I then tried using CInt on RowNumber:
CInt(RowNumber(Nothing) = =1
Then I can deploy it, but the error just changes back to the first one:
Cannot compare data of types System.String and System.Int32.
It seems no matter what I try here I either can't deploy the report or I get an error that I'm comparing a string to an int.
RowNumber returns an integer, so it seems like this should work. I've tried using the name of the dataset in place of "Nothing" but that doesn't change what I'm seeing.
I realize there are many ways to solve my initial problem, but I am curious as to why the filter expression is invalid.
Its better to hide a row with visibilty property. Just click on any text box and go to visibily tab . You can now click on show or hode and go to expression.
That default to Hide . So write an expression there to hide the row.
=IIf(NOT(RowNumber = 1),TRUE,FALSE)
Let me know if you get any error
RowNumber is not available to use in a Tablix Filter.
Using RowNumber(Nothing) <> 1 as a Row visibility property fixed the issue.
Using BIDS you are not given any error that indicates what the problem is, but importing the report to Report Builder and deploying it from there will give a more descriptive error that, in the end, helped me to solve my problem.
I am building a report that I would like to accept two values from the user, feed those into a query, and find the data associated with those entries.
For example, if you had a list of employees, performance measures, and values associated with those; then the user would select an employee name / performance measure, and they would get the scoring information on that employee for that measure.
I have two parameters, each being populated from SQL queries getting a distinct list of employee names and measures, and a table below that just pulls up information based on ~ 'WHERE name = #Name AND measure = #Measure' but when I click 'Preview' to run the report locally I get the error: "one or more parameters required to run the report have not been specified"
I know the parameters are working properly because I can feed their values directly into a textbox and the values populate correctly. Also, if I change the query to just accept one parameter (i.e. WHERE measure = #Measure) the query works.
I'm confused as to why this error is occurring since I know my parameters are functioning and being populated properly.
I experienced this behavior in .NET 4.0 using Local Reports (in .rdlc files), when one of the parameter's values was containing an emtpy string. Although setting the parameter was correct:
report.SetParameters(
new List<ReportParameter> {
new ReportParameter("Title", Messages.Title),
new ReportParameter("SubTitle", Messages.Subtitle))
}
);
It worked only as long as both parameters actually contained some characters, otherwise the mentioned exception was thrown.
This error is caused when you either
A) the parameter is spelled wrong in the actual report. Meaning that the query is expecting #Name but the report is passing #Names (or some other spelling).
or
B) Is it possible you are attempting to run the report with a default value on the parameter of NULL for #Name but the stored procedure requires an actual value?
This might be happening if you are building the report in Visual Studio and gave the #Name parameter a default value of (null).
Try removing the default value or making sure you #Name parameter has an actual value, even if it's just ''.
I had similar issue. Issue happened when you use SharedDataSource with parameters that are to have null value. If you use same query in embeded data source, there is no problem.
Unlike embebed data source, you have to define if parameters used in query of shared data sources are allowed to have null value as highlighted in screenshot here. In my case, there are two parameters in query of shared data source, that can have null value.
So after setting them to allow null, problem fixed!
This caused me many hours of pain. Turns out that it's to do with using a shared dataset.
Embed the dataset within your report instead and it works fine.
For me, setting the value of the parameter makes problem. I don't know why, but the parameter value was not able to accept a string.Empty or null. So i just gave a " " as value solves the error.
Sample
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("Name", EName);
parameters[1] = new ReportParameter("ShiftName", CurrentShift);
parameters[2] = new ReportParameter("Date", LoginDate);
if(ValidateReportData())//some condition
{
parameters[3] = new ReportParameter("Date1", LoginDate);
}
else
{
//parameters[3] = new ReportParameter("Date1", string.Empty);//this makes exception while calling Render function.
parameters[3] = new ReportParameter("Date1", " ");//Solves the issue.
}
I was having the same problem, it is now sorted on sql server 2008 r2.
I know this is now an old question,
but just to help others:
It was very simple really, just making sure the spelling including the case is the same and the use of #.
I have a shared dataset called currentSpaceByDrive with the following code:
SELECT
[DRIVE]
,[Volume_Size_GB]
,[VolumeSpaceAvailable_GB]
,[VolumePercentAvailable]
FROM monitoring.dbo.currentSpaceByDrive(#ServerID)
I add the shared dataset currentSpaceByDrive to my report and I give it the same name.
when I right click on it, the one on my report, dataset properties, the parameter is #ServerID.
#ServerID value comes from another dataset, called the_servers (where the user selects a serverID)
I have a report parameter also called #ServerID that gets its value from the_servers and is used to feed the #ServerID parameter on currentSpaceByDrive.
Too many #ServerID, I understand, but if you do your own test based on this, you will get it done.
See the image attached.
hope this helps
marcelo
check DataSet In Report Server , I had Similar Problem , I was Editing Shared Dataset in Visual Studio , but it didn't work , after an hour of frustration I checked dataset in report server and I found out it Is not updating with changes I made in visual studio , I Delete it and Redeploy Dataset Again from visual studio . it works .
Actually I had to:
Delete the SubReport object from the report.
Drag new object from Toolbox
Setup the SubReport name and report
In Paramateres "Add", and choose each parameter, and related value.
Then is works for me.
I think I have same issue my Parameter Supervisor is blank when I choose "Select All" which causes the error "One or more parameters were not specified for the subreport", but if I select a few supervisor name then the sub-report appears. It is puzzling because the Manager parameter value shows all value when "Select All" is checked, but it is not working on my Supervisor parameter. Note that Supervisor parameter is dependent on manager parameter.
I'm using shared DataSets for several reports, and the root cause of this issue was not mapping the input parameters from the report itself to the parameters of the shared dataset.
To fix, I navigated to the "Report Data" panel, opened the dataset (which is really linking to a shared dataset), clicked the "Parameter" tab, and then mapped the report parameters to the parameters of the shared dataset.