I was handed an old Access db someone else built awhile ago. I added one field to an existing query, but when I went to save it threw an error on a different field I never touched. Error message: Invalid Use of Vertical Bars. Here is the expression it didn't like, but somehow they were able to save it in the past:
DaysOpened:
IIf([re_close_date] Is Null|IIf([close_date] Is Null|Date()-[date_reported]|Date()-[reopen_dt]))
I've tried switching to commas and &'s, but can't get the right combination to rebuild this if someone can help? Basically...if re_close_date is null, check if close_date is null. If yes to both, record must still be Open so we need to calculate DaysOpened by taking current Date and subtracting date_reported or current Date - reopen_dt if record was reopened. Thanks.
Replace those bars to obtain a valid syntax:
IIf([re_close_date] Is Null, IIf([close_date] Is Null, Date()-[date_reported], Date()-[reopen_dt]))
or perhaps:
IIf([re_close_date] Is Null, IIf([close_date] Is Null, Date()-[date_reported], Date()-[reopen_dt]), 0)
Finally solved it by switching my Regional Settings for List Separator from Vertical Bar to Comma, and switching to IsNull() function. Here is what finally worked:
DaysOpened: IIf(IsNull([Re_Close_Date]),IIF(IsNull([Close_Date]),Date()-[Date_Reported],Date()-[Reopen_dt]),0)
What is frustrating is even if you use the Expression Builder, it will tell you to use Vertical Bars (instead of commas) for IIf statements, but then will throw the Vertical Bar error message as soon as you try to run it. To solve this, change your OS settings in Windows as follows:
Control Panel > Region & Language > click Additional Settings under Format tab > change the List Separator value from | to ,. Click Apply and then swap vertical bars out for commas in your expression.
Related
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.
To meet my expectation, I have tried this code in fontweight expression as well as field value expression
=iif(fields!RATE_SELECTED="A","BOLD","NORMAL")
I end up with an exception
Error BC30518: Overload resolution failed because no accessible '=' can be called with these arguments
Please help.
You are missing .Value in expression.
It should be:
=iif(Fields!RATE_SELECTED.Value="A","Bold","Normal")
Also, it should be "Bold","Normal" instead of "BOLD","NORMAL"
and due to some SSRS bug, if you try this, and it still doesn't work,then the trick is:
Try first clearing the previous values and then Click OK >> OK till you again reach the Report Designer screen.
From here, again right click your report item, say TextBox, right click >>TextBox properties >>Font>> fx (near Bold) and when you here
then, instead of manually writing the full expression, write only =iif( then click on Fields [see fig] and choose RATE_SELECTED ,similarly click on Constants and double click Bold, and then Normal
then, with your manual edit, the final expression should be like
=iif(Fields!RATE_SELECTED.Value="A","Bold","Normal")
HTH
I have the following query in access used in a report for data selection. It works except that it truncates the What_happened field.
The sql database has the what_happened field as a nvarchar(max) - access 2010 see's it as a memo field.
I need to be able to see the full contents of the what_happened field on the report form
Thank you,
Steve
SELECT DISTINCT dbo_all_clients_view.people_id,
dbo_all_clients_view.full_name,
dbo_event_log_shack.actual_date,
dbo_all_clients_view.is_active_client,
[dbo_all_clients_view query].policy_num,
dbo_event_log_shack.event_log_id,
dbo_all_clients_view.dob,
dbo_event_log_shack.eventtime1,
dbo_event_log_shack.is_deleted,
dbo_event_log_shack.staff_name,
dbo_event_log_shack.staff_supervisor,
cir_descrip_staff_resp.what_happened
FROM cir_descrip_staff_resp
RIGHT JOIN ((dbo_all_clients_view
LEFT JOIN dbo_event_log_shack
ON dbo_all_clients_view.people_id =
dbo_event_log_shack.people_id)
LEFT JOIN [dbo_all_clients_view query]
ON dbo_all_clients_view.id_no =
[dbo_all_clients_view query].dbo_all_clients_view_id_no)
ON cir_descrip_staff_resp.[event id] = dbo_event_log_shack.event_log_id
WHERE (( ( dbo_event_log_shack.is_deleted ) = false ))
ORDER BY dbo_all_clients_view.full_name,
dbo_event_log_shack.actual_date DESC;
A great many things cause memo fields to be truncated. In a report, you can DlookUp the memo or use another query to get the full text.
There is a pretty good list of possible reasons here: http://allenbrowne.com/ser-63.html
I was looking for this answer as I knew I had found out how to fix this from a post a few years ago. I subsequently remembered how and it is the most excruciating bad bit of work I have known. As it seems to have been lost from the current knowledge I thought I would put it back out there.
When you are in the export window, click advanced. It shows a grid of field information. If you put your mouse over the 'Field name' heading and then move it right the cursor turns to a line with 2 arrows, move farther to the right and it turns to 2 lines with a space and 2 arrows. Click and drag right and you by magic get the skip field, go back to field name heading , do the same again and you magic the indexed, repeat and magic the width then the start and next time the data type. Ah the data type says it will be exported as a short text field, change it to long text and that is what it exports.
If you are using import/export saved specs to put in your vba, you can similarly expose the data type it will be exported as.
It works with older versions and it works with SQL server linked odbc tables.
I've also just realised that those one field queries probably aren't needed either if you select the skip option for the ones you don't want.
Hope this helps someeone :)
I have a parameter of integer datatype which is hidden. When i run the report, report gives me an error
Parameter X is missing a value
However if i make the parameter visible it works. I tried providing default value of 0 but that does not suffice my requirement as i have sub-report(Drill-dowm) depended on this parameter. Please help. Thanks!
Make sure that you have not specified Available Values for the parameter. Available Values should be "None" for internal and hidden parameters.
First of all,
Check that parameter's - Available Values by going to report parameters properties.
It must not be specified any values. So we should set it as None
Second work around is,
Just add a blank space at Specify values - in Default values inside report parameters properties.
This will surely work. Hope it will save your time.
I had to do an "if exists" statement for this to go away. It worked for me because it makes it always return a value even if that value is not need by my query.
if exists (my select query)
my select query
else
select '2'
// '2' would never be used, but it made ssrs stop giving me
// the stupid error and execute the rest of the query
If you specify available values from query, then default values must be in list of available values. Default value in (Available) = true.
The problem occurs also, if you have a parameter that depends of another one without "default value" inside the Dataset Query and does not admit null value.
For example:
Parameter 1 have a default value: NameEmployee from the dataset "EmployeeSearch"
But the dataset "EmployeeSearch" have a filter or a parameter inside the query named #Month that indicate the number of the month. So if the value of #Month is null, SSRS will say "Parameter is missing a value".
Assuming you had the same issue as I had, trying to run the report on a web page using a ReportViewer component, I managed to fix that issue by adding a null parameter before rendering the report:
C# code:
var parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("ParameterName", (string)null));
ReportViewer1.ServerReport.SetParameters(parameters);
Hope that will help
Just need to add 1 default value to get around this error (even though that default value will never be used).
-Under "Report Parameter Properties" for that specific parameter, go to the Default Values page.
-Toggle "Specify values"
-Add a value (I added: "just_a_filler_to_get_around_hidden_value_error" so when I look back at it later I remember why I did such a thing)
-click OK
I want to add to dmbreth's CORRECT answer.
I was missing the concept that the value of the parameter still needed to be tied to something. Originally, I was tying the output of a dataset by using the Available values portion of the parameter properties, but according to dmbreth's answer, that could not be the case. Finally I moved my output dependence settings from the Available Values section to the Default Values section and that did the trick.
So, in summary, in the parameter properties dialogue:
General Page - Allow multiple values checked(this option is specific to my application), parameter visibility set to internal
Available Values Page - None
Default Values Page - Get values from query, [appropriate dataset, value here]
Advanced Page - No significance here
Hopefully, that is clear enough to benefit someone else with the same problem...
I had a similar issue where the default value as set by SSRS is (Null), I didn't need the parameter for my report however; I found it useful for testing to filter down the list so I kept it, I guess I could have deleted it in SSRS on the dataset config. but I changed it to =System.DBNull.Value (I guess this could be any expression) instead and that worked for me, so then I can still pass in a value if need be and also set Available values (had to make sure a NULL value was added to my dataset) if I then decide to unhide at a later date.
There is one other potential here. I have had a situation where the report designer works but the server report object does not. The solution is to delete the server object and then re-save it from the designer.
I have a database that I've been building and from time to time all of the queries that have paraeters defined by text boxes on a form (driven by the where clauses) do not work. Instead, Access asks me for values in the form of parameter dialogue boxes for all the quires set up to work off the form. I've run into this several times and I've stripped out the last change that I've made and it all functions as designed (until now).
The question is - what is causing this? It's like none of the where clauses function.
Thanks for any input....
Your SQL would be good however at a guess you probably need to specificly declare the type of the paramaters either by using the paramaters dialog box (Not sure where it is in 2010, we are still using 2003 here!) or by using the PARAMATERS keyword (from memory... may not be exactly correct...)
PARAMATERS [forms]![someForm]![someTextBox] DateTime,
[forms]![someForm]![someComboBox] Decimal;
SELECT x,y from tblZ
WHERE x=[forms]![someForm]![someTextBox]
AND y=[forms]![someForm]![someComboBox];