SSRS SQL report builder deleting column - sql

I have a problem with SSRS report builder. Basically what I want to do is to delete a column. I have a report that someone else made and there is 1 column (xxx) that no longer exists in data source tables so I need to delete it.
When I go to query designer and delete this column from the code and run it there, it works. I close query designer window and see that list of columns (fields) is updated now and xxx column is not there. Then, I delete this column manually in designer (default screen) and when I try to run the report, It doesn't work:
"The Value expression for the text box ‘XXXDataField’ refers to the field ‘xxx’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case."
But that field should be already deleted. So I don't know what else I can do, or what it can be linked to. I just want to delete it. Any Idea?
Thank you

If your dataset does not contain xxx but your DataTable has this error is normal
You either delete that column from your table or at lease delete DataSet Binding from table so that SSRS does not try to retrieve that column from DataSet

It will be a reference to the field in another field. For example, if you deleted a column that showed an OrderShipped status, then you might have another text box highlighted based on this.
The error is telling you which textbox is in error. So, click somewhere on the designer, then in the properties window, right at the top, click the dropdown which allows you to choose specific report items, choose XXXDataField (the one named in the error message) and then check the value expression. In there you will find the reference to the column you deleted.

Related

VB.net add DataTable rows to DataGridView

I've tried to find a solution to this, but can't seem to find anything that quite matches my goal here. The answers I've found are either C# or are wanting the data to go from the DGV to the DT.
I have a datatable, which is built out using an SQL query. In this data table, I have a column "Lab ID" that I want to use as a search index. On my front end, there is a requirement for the Lab ID to be supplied. When the Lab ID is entered, the data table should be searched, and the resulting row (entire row) should be added to the datagridview. Each scan should add a row and not overwrite. I have specified the DGV columns at form load but would like it to grab the column names from the table if possible.
Here is my current front end - noting that the left datagridview is only temporary to confirm the data is coming out of SQL and references the same datatable I am wanting to use for the right DGV. The user will pick the dates, enter the Lab ID, then click Check. If the Lab ID checks out, it should be added.
The other thing I'll need to able to do is compare the results in the data table with what is in that datagridview - if an item in the table is missing in the datagridview, I need to be able to retrieve the missing Lab IDs (don't need the whole row for this one) and add those missing Lab IDs to a messagebox.
I don't have any code at this point because I've not found anything that works, with the exception of this:
dgScanned.Rows.Add(GetResults.Rows)
Which results in the string 'System.Data.DataRowCollection' being added to the 'Request ID' column.

MS Access: Dependent drop down combobox in Split form without affecting the rest? [duplicate]

This question already has an answer here:
How to query combo box of only current record/row in Access data entry form?
(1 answer)
Closed 1 year ago.
I am trying to make a dependent drop down work with my database here but it is giving me a hard time for different reasons that I will explain.
This is what I have:
A form called "tblOTS" (split form based on an actual "tblOTS" table):
As well as a table called "tblAlphaCode":
When looking at the property sheet for the "Alpha Code" combobox (actually called "strOTSAlphaCode") on my tblOTS form, this is what I have:
The current SQL statement under "Row Source" for this strOTSAlphaCode is:
SELECT tblAlphaCode.strAlphaCode, tblAlphaCode.strCategory,
tblAlphaCode.ID, tblAlphaCode.numSortingOrder
FROM tblAlphaCode
ORDER BY tblAlphaCode.strCategory, tblAlphaCode.numSortingOrder;
Basically, when user select an Alpha code in the drop down from "tblOTS" form, it adds the ID of the tblAlphaCodes into the actual tblOTS record.
My goal is to have the user select first a "Category" (here FASTENERS/HARDWARE ...) when adding/modifying an OTS record, and then have the "Alpha Code" drop down dependent on what category was just selected.
I first tried to changed the SQL statement using a WHERE condition on the category field, based on the form category field itself:
SELECT tblAlphaCode.strAlphaCode, tblAlphaCode.strCategory, tblAlphaCode.ID, tblAlphaCode.numSortingOrder
FROM tblAlphaCode
WHERE (((tblAlphaCode.strCategory)=[Forms]![tblOTS]![strOTSCategory]))
ORDER BY tblAlphaCode.strCategory, tblAlphaCode.numSortingOrder;
And created a strOTSAlphaCode.requery in my Form_Current event to update it everytime.
However, it affects the whole form itself as my control source is directly affected by my Row Source in this instance, and the form looks like this:
You can see that the drop down is working beautifully, however, all the fields that do not have the same category as the current record that I work on (FASTENER <> HARDWARE here), are missing their Alpha code (the second record is missing "O-RING" compared to the first picture from this post); this behavior is problematic!
I tried to find workarounds by changing strOTSAlphaCode into a simple text box only containing the Alpha Code ID, added an unbound text box on top with dlookup function to find the actual alpha code related to this ID, and an unbound combobox in between with the exact same SQL statement inside the Row Source Property, that would update the strOTSAlphaCode with some VBA ... not ideal right?? Ahaha. This is why I believe there is a simpler way that I am not aware of, but also I would like to use a "search as you type" code for this combobox later on and this solution was making it very difficult.
How can I make this work? I believe the answer is a simple/different SQL statement to put in my Row Source property, that is probably something related to some type of JOIN statement? Or something else? I expect to write some VBA code to make all of this work flawlessly, but I want to make sure that I have the right SQL statement first.
Thank you June7;
Yes, the link you gave me ( this link ) states 2 solutions, and the second one is the one that I talked about when describing my problem:
for forms in Continuous or Datasheet view, include lookup table in form RecordSource, bind a textbox to descriptive field from lookup
table, position textbox on top of combobox, set textbox as Locked Yes
and TabStop No
So I guess, the answer is that I MUST have a textbox with dlookup setup for my case; I put it on "locked" so that if the user wants to change it by typing in it, he will first have to select the arrow. This will work with what I wanted to do
Cheers,

MS Access Binding Textfield to tables

I am currently building a MS Access database as a project #Work.
The Database is fed with a huge, not sorted Table DataQueryExport, and the objective is to create a GUI that makes that huge table workable.
Now to the question:
I have a textfield Comment that is supposed to show a comment to a specific data entry WorkID. The WorkID Is stored in a seperate table called WorkID_Comments which is filled via SQL query. The Table WorkID_Commentshas 2 columns, WorkIDand Comment.
The GUI has a ComboBox WorkID_Combo, where you can select a specific WorkID from the main Table DataQueryExport. This exact value is what is supposed to be used as a reference to show the comment for that WorkID.
TL:DR; I need the Comment Box to show and store the Text I wrote for that Value selected in the ComboBox. How do I get the Textfield to show the Value from the Table WorkID_Comments.Comments where the Value in WorkID_Combo(View ComboBox) is the same as WorkID_Comments.WorkID
I apologize beforehand for any weird capitalizations, I am used to it, German is my main language.
Thank you for reading, I am thankful for any response.
Build a query in the query designer with your needed columns (If I understood it correctly: ID and the Comment).
Then go to your combobox and chose under properties recordsource table/query and your designed query.
Now you can specify which colums should be shown and use the ID as the value in the background.
Then bind another query to your form (here is the text you wrote as column) which is linked to the ID from the combox. Put a textbox in the form and use the column as source.

Breaking the SSRS report depending on the Multi Value Parameter

I am working on a SSRS report with a Multi Value Parameter which contains list of names. I have written an expression for the title that works like "Result for SELECTED NAME". It also have an option of (Select All) which displays all the results with title as "Result for MULTIPLE NAME". It is working fine up to this part.
Now I have to modify the report like, If i select multiple values, the report should break into pages with each selected name on different page with title for that individual parameter value(name) as "Result for SELECTED NAME".
Please help me. Thank you.
You can place the entirety of your current report (excluding headers/footers) into a List object. I assume youa re returning the selected values from the parameter (like Manager Name) as part of your DataSet. Assuming this is the case
Create a new list
Insert the contents of your report into the rectangle of this List
Right click the List Row Header and Select Row Group -> Group Properties
Set the Group to Group on
=Fields!ManagerName.Value
This approach will take a simple table like this
And break it into a list like this
Then you can just set the Tablix Properties of the List to Add a Page Break After to checked
Hopefully this is helpful. If you have further questions on this then please let me know
I worked on it and found a way to make it happen. I first created the row group for Names. Then applied the page break for each instance option. Then deleted that group column (Only deleted column but not group). Then added that group in a static column on the top, and wrote an expressions to show that group itself as a title using concatenation.
But here I faced another problem, when there is no data for the selected name, the title row isn't displayed in the preview as it also a column in the table.

dynamically adding columns into SQL Reporting services

The stored procedure mapped to a report query builder returns values dynamically mean to say once 8 columns and sometimes 6 columns. My question is how to name the header for the extra added columns?
For each dynamic column, right-click the column header and choose properties. In the properties pane, under the Visibility section, click the down arrow beside Hidden and choose <Expression...>. Paste in the following and change the the field name to match your database.
=IIf(Fields!name.Value Is Nothing, True, False)
When you run the report, if the values in the dynamic columns are NULL, the column will be hidden. If it contains non-null values, the columns will be displayed.
One Important thing to remember: When we are binding a dynamic dataset, SSRS dont have capability to detect the Fields present in the dataset. For this we need to specify the all possible fields in the Dataset, To do this follow the steps:
Goto Data tab in the report and open the dataset which returns
dynamic columns
Click on the … button besides the dataset to edit the dataset
A pop-up window for dataset will appear, in that window go to Fields
tab
There we have to write all possible fields in the Dataset
Click OK and Preview your report
Have you tried doing a COALESCE in your sp, where you always get back those 2 "dynamic" columns? Something like COALESCE(sp.YourColumn, NULL). Then you would be able to create an expression in the report and have it hide that column when NULL or a blank is returned. Maybe something like for the Visbility = IIF(Fields!DynamicField1.Value is Nothing, False, True).
Tweak your stored procedure so that you always return 8 columns. Simply return NULL in the two dynamic columns if you don't want them in the report.
For each dynamic column, right-click the column header and choose properties. In the properties pane, under the Visibility section, click the down arrow beside Hidden and choose <Expression...>. Paste in the following and change the the field name to match your database.
=IIf(Fields!name.Value Is Nothing, True, False)
When you run the report, if the values in the dynamic columns are NULL, the column will be hidden. If it contains non-null values, the columns will be displayed.
Good luck, and welcome to the site!