We are using SQL Server Reporting Services for our reports. We have a report that is comprised of several sub reports. For simplicity, let's say cars. And each car has it's own part list. A one-to-many relationship.
So on the Car report, there's all the car information - and a sub-report, the part list. This works fine for a single car as there is a single Car.ID, which can be passed as a parameter to filter the Part List by the specific car.
But, if there's several cars specified to the report, we want each car to be on it's own page. with it's own part list.
I've had a look around an am struggling to figure it out. The solution I'm looking at involves putting everything in a List control, adding a page break after each record. Then adding a row number to each item in the dataset, then matching page number and the row number up for the sub-report.
I figure there's got to be a simpler way to do this, that I've overlooked. Or if there isn't, how can I match up the Page Number and Row Number? I've tried using the Lookup function --
=Lookup(=Fields!Page.Value, =Globals!PageNumber, =Fields!ID.Value, "DataSet1")
However, this returns an error that the Globals!PageNumber variable is only available to the page header/footer sections.
Any help is greatly appreciated.
Never mind, I was being an idiot and completely over complicating it.
If anyone else find it useful, here's the steps.
Create your sub-reports, specifying the ID of the record as a parameter.
Create your main, encapsulating report.
Add a list control to the page, go to the Tablix properties and add a page break.
Add your sub-reports to the list control
Specify the value to the identity parameter, by using the fields collection - in this case:
=Fields!ID.Value
Test report, then sit back and don't think about how complicated I tried to make it.
Related
Its a tricky situation fail to get it. i am a newbie in SF. Here is the scenario --
There is a lookup filter on Product Interest field &
Product Brand is a PickList
what's happening is that out of 6 picklist values for Product Brands only one is causing Lookup functionality to fail i.e Products corresponding to that particular brand do'not show up in Product Interest field.
-Show All does nothing,
-Typing related values (from Workbench) does nothing,
-Adding a new product does not register new product with that particular brand.
-tried comparing WorkBench data with other brands no conclusion still
Any clues y'all might be able to provide. Thank you so much in advance.
Regards,
Sunny
Some screenshots would help to understand your issue...
Data visibility
Are you sysadmin? If not - maybe there are matching rows but sharing rules prevent you from seeing it. Does it show the records in the lookup OK when you change the filter from mandatory to optional?
Data quality
Are you sure there are no typos, that the brand picklist on the record you're creating / modifying is identical to the brand picklist (or whatever it is) on product? Don't look at the label (what's shown in the UI), look at picklist value (what's actually stored in the database). Labels can be translated to other languages but filters and custom code compare values.
Other debugging ideas
Is it a standard create/edit screen or a custom component? If needed - would you know how to run the standard create screen and/or go to Classic UI?
Can you import a record bypassing the UI. Ask admin how to use Data Import Wizard, Data Loader or maybe programmer could help you with piece of code to run in developer console. Something like
MyObject__c o = new MyObject__c(
ProductBrand__c = 'Problematic',
ProductInterest__c = '01t....' // the Id of product you hope to see in the lookup that has same "Problematic" picklist value
);
insert o;
System.debug(o.Id);
Maybe it'll work, maybe it'll throw you an error that will help investigating.
Do you have record types on the object, maybe the problematic picklist value is not legal for the record type you're using and you'd need to allow it first.
Can you reverse the create action. Like go to Product layout editor, add a related list of "MyObjects" (or whatever it is you're inserting) and try to create using the "New" button on the related list. Hopefully that should come with the product preselected in the lookup or show you some error.
This is my first question on StackOverflow so apologies if there is not enough appropriate information.
Rather than having four different tables that I try to position 'just so' so that they look like one table, I was hoping to have all of my data in one visible table and hide the rest.
To do this I was trying to use LookupSet/Lookup with Running Value (I need a cumulative figure for each fortnight from a start date).
I have used the following code which supplies me with figures in the table - however the figures seem to be nearly double what they actually are.
=Lookup(Fields!StartFortnightDate.Value, Fields!StartFortnightDate.Value,
Fields!RowIdentifier.Value, "KPI004")
Is it possible to use Lookup with RunningValue? It won't let me use ReportItems either its obviously only pulling from the first box and therefore is just repeating the first figure again and again.
Any help, guidance, or even a simple "it's not possible" would be appreciated.
Edited to add more information as suggested:
It's difficult to add example data without worrying about data protection etc.
Report design is currently:
ReportDesign
Each table has it's own dataset - I'm trying to get them all into one table.
Lets say the first dataset is number of cars sold in each fortnight.
The second dataset (table) is number of meetings held.
The third dataset is number of days weather was sunny/cloudy/rainy etc.
(This obviously isn't what the datasets are, but I'm trying to show that they don't actually relate to each other that much and therefore can't all be in the same script)
All datasets have a table of the fortnightly dates within that quarter, my hope was to get one table that showed the cumulative figures of each item even though they're not in the same dataset - the tables are all grouped by the StartOfFortnightDate.
The script =RunningValue(Fields!NumberOfFordCarsSold.Value, Count, Nothing) and similar works fine in the separate tables, however if I add a row to the top table and try to use RunningValue with Lookup it doesn't work.
When I used the script mentioned at the top (Lookup script) I get inflated figures (top row of this image) compared to the expected figures (bottom row of the image): IncorrectAndCorrectFigures
Apologies if this doesn't make sense, it's likely that my complete confusion in trying to find the answer is coming across in the question.
If the resulting datasets are all similar then why can you not combine them?
From the output they seem to be just Indicator & Date.
Add an extra column to indicate which set of data each row belongs to (Cars Meetings etc), this might help with grouping rows in the report.
Context
There are two excel.workbooks in the same location: database and dashboards. Whereas database.workbook has as many tabs as clients I manage, dashboard.workbook has as many tabs as reports are required.
Navigation across report's (dashboard.worksheets) it's pretty simple. On each report there's a combobox that contains every dashboard.worksheets' names. Selecting any report on that combobox hides the current worksheet/report and open the desired one.
In each tab/report there is a second combobox that allows you to select a client, populating the report with the selected client's data.
The report
The information in the database looks like this:
Date|Device|Group|Subgroup|metric1|metric2|metric3|etc.
The information displayed in the report (in the one I'm having issues with) looks like this:
Group|metric1|2|3|...
The issues
1) Currently the group is displayed like this:
=IFERROR(LOOKUP(2,1/(COUNTIF($C$17:C18,IF($C$8="Goldsmiths",Client1_GroupName,IF($C$8="Client2",Client2_GroupName,IF($C$8="Client3",Client3_GroupName,IF($C$8="Client4",Client4_GroupName)))))=0),IF($C$8="Client1",Client1_GroupName,IF($C$8="Client2",Client2_GroupName,IF($C$8="Client3",Z2,Client3_GroupName($C$8="Client4",Client4_GroupName))))),"")
The combobox prints its value into Range("C8"). Through a nested ifs structure the formula identifies the client and then pulls a unique list of groups from the selected client tab (from database.workbook).
One issue is that it is very messy and hard to escalate (the more clients I get, its complexity growth exponentially). I bet there are easiest ways to do it (maybe VBA?).
It can be quite slow, the more "groups" we get and more days recorded into the database, more slow it will get.
2) Pulling the data
Most of the data to pull can be done through array formulas like this one:
={SUM((Client1_GroupName=C20)*Metric1)}
It sums all the Metric1 for the group matching C20,C21,22,23 (in that c20:xx range we have the first formula pulling the Group list.
I haven't added the nested ifs yet. It's going to be a pain to do it across 5 more columns. Again very hard to escalate.
This can be terribly slow. It comes a point that changing client means waiting 2 or 3 minutes to process the array.
Conclusions
I guess what I'm seeking is some advice on how to face this issues, which essentially are: scalability and speed.
I have custom object 'Subject_c' with 3 fields and I have created those objects by uploading a CSV file. Subject_c has a lookup relationship with Leads (Its general for the same user regardless of what lead he is viewing). I am able to insert a related list and I can see that the objects are created under Data Management/Storage Usage. But it shows blank under related list.
You're saying that the custom object has lookup to Lead but then you say Subjects are generic and somehow should be displayed on every Lead page? I don't think it'll work.
Stuff appears on related list only when field Subject_c.Lead_c will be populated with "this" Lead's Id. (please note I've made best guess at the field name). So you'd need to insert separate data for each Lead which can quickly blow your storage usage and will be a pain in the a$$ to maintain later. Is it only for displaying? Or do you plan to later capture some kind of survey results for each Lead?
If it's just for display I think you'll need to embed a Visualforce page in the Lead page layout to achieve that in a saner way. The subjects are specific to current viewing user? Or it's more like a general list, just 3 subjects for whole organisation?
P.S. "object" is like a table in normal database. I think you mixed a bit the difference between table and records / rows of data stored in it.
Okay. two questions on interactive sorting:
1. How to sort on multiple columns without holding SHIFT key?(like this: http://lukehayler.com/2011/04/sorting-on-multiple-columns-in-ssrs/)
2. How do I cancel sorting? So, usually on most web, first click on sorting arrows icon sorts by ascending, second click sorts by descending, third click cancels sorting. With SSRS I only observe first two options. Is there a way to cancel column sorting?
1) Right now that is just how the report viewer works, as others have said you could write your own controll to view the reports but this may not be an option due to time or skill level constraints.
Other people have written their own custom report viewer controls however I have always stuck to the MS version so I havent got much experience with these, and I would suspect any good ones would be a paid solution.
2) I would love this option myself, again you cant reset the sorting in this way as SSRS does not keep a record of the initial 'unordered' state of the data.
The only options you really have here are to reload your data with its original parameters or as nathan pointed out include a column that contains the starting sort order, however users may not like this as it is adding data which is not really relevant to the report data.
1) There is no way to do this with the standard report viewer control
2) There is no way to "cancel" sorting. However assuming the data was sorted into some order originally then you could include a column on the report that represents the original sort order (if it's complex ordering then you could represent this with a sequence number). This would allow the user to sort on that column to return to the original order of the report.