Disable multiple record navigation for sub-form - forms

I am working on putting finishing touches on a tool after a developer abruptly quit and left no documentation. I have been able to fix everything except for the following.
I am creating a bar chart using data from a select query:
Date Facility Bucket Variance
2/5/15 A >$10k >90 -2.1234
2/5/15 A >90 -10.567
... ... ... ...
Using the chart wizard, I select Data: Variance, Axis: Bucket, Linked fields: Facility, Date (users can select these from the main form).
The chart itself looks perfectly fine, but in the main form a navigation bar appeared, giving me the option to switch between 6 records. Switching changes the graph in no way, shape or form.
http://i.imgur.com/qq6xiqi.png
While I can disable/hide the bar, whatever thing caused it to believe there were six unique records makes it print the same chart 6 times when printed or sent to PDF.
http://i.imgur.com/la9JBCs.png
Any idea what is causing this, and how I can prevent it?
Thanks!
EDIT: I should add that there are 6 unique values for facility and bucket. Date, Facility and Bucket make up the primary key for their table.
EDIT2: It's the Bucket causing this. Joining a facility filter table with the query did nothing.
EDIT3: Record Source query
SELECT tbl_Trending_Data.Date, tbl_Trending_Data.Facility, tbl_Trending_Data.Bucket, IIf([Target] Is Null,Null,[Days]-[Target]) AS Variance
FROM tbl_Facility_Filter INNER JOIN tbl_Trending_Data ON tbl_Facility_Filter.Facility = tbl_Trending_Data.Facility
ORDER BY tbl_Trending_Data.Bucket;

Change your recordsource query to:
SELECT TOP 1 tbl_Trending_Data.Date, tbl_Trending_Data.Facility,
tbl_Trending_Data.Bucket, IIf([Target] Is Null,Null,[Days]-[Target]) AS Variance
FROM tbl_Facility_Filter
INNER JOIN tbl_Trending_Data
ON tbl_Facility_Filter.Facility = tbl_Trending_Data.Facility
ORDER BY tbl_Trending_Data.Bucket;
You need to limit it to TOP 1 so that you're only looking at the first row. That will stop the program from printing multiple records/charts.

Related

VBA to drill down specific data on Pivot Table

I am trying to get code so that by pressing a button, users can download certain source data from the Pivot Table. I have a PT set up that is controlled by slicers, so the PT size changes depending on what is selected (customer, date).
I have tried to record a macro, but when I double click the data I want to see, all the macro records is the cell reference, so this wont work if a different customer is selected.
I have attached some images which I hope helps demonstrate what I am trying to achieve.
Is there code that can do this? If so, can I get an example so that I can try to make it fit my working model?
Thank you
Raw data view
Pivot Table
Drill Down 1 e.g.
Drill down 2 e.g.

In SSRS, can you group multiple parameter values into one?

I am relatively new to SSRS but have been working with SQL for years. I have been tasked with creating a report that reflects shipped items based on their status. For example, I have x number of items with varying statuses including "IN_TRANSIT", "RECEIVING", "SHIPPED", "WORKING", and "CLOSED". The requestor is asking if I can provide the following options in a report drop down:
"IN_PROCESS" Status filter including all statuses except "CLOSED".
"CLOSED".
Essentially, they want to be able to view all non closed statuses, closed, statuses, or all. Right now, I have it set so you can individually select all statuses, essentially getting them the data they want, just not with the "right" parameters.
My question is, does SSRS provide a way to essentially 'group' the non-closed statuses into one inside the report so that when they select "IN_PROCESS" it sends those non-closed statuses to the SQL query I have built in? The problem with using SQL for this is that the dataset I created to generate the dropdown options provides "CLOSED" and "IN_PROCESS" as it's output options, but when they select "IN_PROCESS" (sending that value to the filter in the report), since it's not an actual status, nothing comes back.
If more information or clarification is required, please let me know.
Thanks ahead of time!
You can create a new column in your SQL query and use a CASE statement to give the value of IN_PROCESS or CLOSED for the applicable status. Then you will just need to the filtering condition to match the SSRS parameter to the new column.
Depending on how often this case is likely to be reused should help determine how to approach it. If it sounds like it might become a regular process.... "Oh can we have another report with the same filter but showing xyz " then take the time to setup correctly and it will save time in the future.
Personally I would add a database table, if possible, that contains the status names and then a status group name (ignoring fully normalising for the sake of simplicity here).
CREATE TABLE StatusGroups(Status varchar(10), StatusGroup varchar(10))
INSERT INTO StatusGroups VALUES
('IN_TRANSIT', 'In Process'),('RECEIVING, 'In Process'),('SHIPPED', 'In Process'),('WORKING', 'In Process'),('CLOSED' 'Closed')
Then a simple view
CREATE MyNewView AS
SELECT t.*, g.StatusGroup
FROM MyTable t
JOIN StatusGroups g on t.STATUS = g.Status
Now change your report dataset query to use this view passing in the report parameter like this...
SELECT *
FROM MyNewView
WHERE StatusGroup = #myReportParameter
Your dataset for your report parameter's available values list could then be something like
SELECT DISTINCT StatusGroup FROM StatusGroups
This way if you every add more status or statusgroup values you can add an entry to this table and everything will work without ever having to edit your report.

Display Records Horizontally Instead of Vertical in Cells, SSRS

I'm trying to display multiple values for one drive by adding a column for each additional record assigned to a drive. For example, a drive ID is unique but can have multiple promotional incentives assigned to it.
For example, if we go to a university on 1/23/2015, that will a unique event or record in the DriveMaster table, but if we are giving away T-Shirts and Pizza, those two records will be assigned to the drive in the EquipmentDetail table.
In SSRS, I'm trying to create a sub-report that will display the promotional items on one line instead of adding additional lines for each promotional item. See screenshot below.
What I'd like to have happen is have the each drive only account for 1 row, and each promotional item listed in a new column to the right. See mockup in Excel.
Is there a way to handle this? I know there is in Crytal Reports, but I can't figure this out in SSRS. I've tried using a Matrix, but I can't see to get the columns to grow if there are multiple incentives.
I added a column group on the Description field, and it looks like that it is close, but that the grouping will create blank spaces (cells) in it.
Thanks,
You have to set a Column Group for your promotional item in your Matrix.
Hope that helps.
Edit:
It looks like there are some areas that contain no data (because of your groupings)
We can do something like the following:
In your query you can use the 'over'
Select DriveID, PromotionItem, ... ,
ROW_NUMBER() Over(Partition by Select DriveID, PromotionItem, ... Order by PromotionItem)
AS ColumnGroupNumber
Then in the Promotion Item group that you have change the field it groups on to the ColumnGroupNumber (or whatever you are going to call it). Just don't change the field in the detail row, or you will not see the details.
I have used this solution before. I found it here.

Erroneous duplicate rows in BIRT report

I have a problem with a BIRT report I'm working on where I have a nested table in the report. The outer table contains data to do with an item on an invoice, while the inner table contains stuff to do with price banding for labor charges. I've written a separate DataSet which gets the inner data, bound by parameters to data in the outer table. Now, when I preview the inner DataSet in BIRT using the defaults I've given it, it returns two rows of data for that bill number & item number - a normal rate & an overtime rate if you like. When I run the report in full over the same data, the outer table stuff is fine, but the inner table just repeats the same row over twice - it's just the first row repeating.
This is sorta what the table looks like in layout view:
Item Description Rate Quantity Item total
[item] [desc] [rate] [quantity] [total]
...where the price & quantity are in the inner table.
I'd have expected to see something like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$50 1
but instead I get more like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$30 4.5
...even though querying the database & previewing the inner data set based on the same input criteria show the expected result.
Has anyone else had experience like this? I have a hunch it's to do with bindings, but not sure what.
One way to get this behavior is by accidentally replacing a table-level binding with a column-level binding.
For example, define a table by dragging a data set into the report. Select the entire table (use the outline view, or select something in the table and then click on the "Table" button that pops up just below the grid.) Then go to the Binding tab. Note that the data set and column bindings are all filled in.
Now select just one field in the Detail row. On the Binding tab, note that the Data Set is blank, and no column binding is shown. Someone who is confused by this (as I was) might then edit the column's binding and specify the same Data Set that was used to create the table. If you do this you will only see a single value repeated in that column when you run the report. (I believe the overridden column is binding to a second instance of the data set, not the one the table is iterating over.)
Not sure your question can be answered withou looking at the data and the design. But it is important to note that the results you see in the dataset preview, and not neccisarly what you would see if the query was run fully. I have seen difference with 7 records returned. I thought as it was only 7 it would be the same on full run, but it's not. The preview is not just a top 500 query, it has some other (not sure what) filters also.
To problem solve if it is your query or your binding.
If you are using a SQL database. Run the SQL in a SSMS query and see if you get the same results you do when run in the innner table.
Altentively, create a new test report, copy over your dataset and use with a stand alone table.
I think I sorted it, & this is the most bizarre thing: On the child table I'd been deleting the header & footer row & just leaving the detail row in, in the layout view. Last thing today, just before I was going to go home, I tried again - deleted the table for about the 70th time that day, replaced it, re-did the parameter bindings all exactly as before, but this time I left the header row & footer intact. Clicked the preview tab, voila, all shows up correctly. So, since I didn't need the header or footer on the child table, I went into properties, clicked Hide this element, preview again - all good. No difference to the data bindings, no difference to mappings or anything else, no change to the data sets - the only difference was leaving the header & footer in place but hidden.
Contemplating making a bug report, tbh.

Filemaker 12 -- display one value, store another

I'm building a database in FileMaker 12 that will, among other things, keep a list of jobs (indicated by numeric ID) and the employees who had billable time for that job.
Given three tables:
Employee ( empName, empID, salary, ... )
JobHours ( empID, jobID, hrsWorked, ... , refID)
JobCost ( jobID, expenses, profit, ... , refID)
Where:
Employee is my personnel roster matching names to numeric employee IDs and stats (salary, et al) ;
JobHours is a list of employee participation -- whenever an employee spends time on a job, this table has a line that shows their ID, the job ID, hours worked, and a few other things;
JobCost is a daily record of jobs. One entry in this table refers to the activity for a single job on a single day. Additionally, each entry gets a system generated unique ID (since neither jobID nor date is unique) to relate to JobHours (resulting in a list of who worked on a particular job on a particular day).
I have a form showing records from JobCost. For each record, I can see in a portal, showing records from JobHours, who worked on that job on that day.
Now, the issue.
In my portal, I want to have a drop-down list of employee names pulled from a value list to create records in JobHours with the following criteria:
1) I need it to be a drop-down rather than a pop-up so it will respond to auto-fill from the keyboard. A drop-down will show the secondary value (employee name) from a value list while dropped down, and will respond properly to keyboard autocomplete on the secondary value, but once you've made your selection, it only displays the primary value (employee ID).
2) I need it to display names, not IDs, at all times. The pop-up does this perfectly. However, it doesn't seem to respond to the keyboard for typing autocompletes.
3) I need to store the numeric ID rather than the name.
I know how to satisfy any two of these criteria at once, but that's all. The whole database is working beautifully otherwise. Is this behavior possible?
One common technique is to use two fields, one directly on top of the other.
On the bottom, put your JobHours::EmpID field. Set it up as the drop-down list with the value list that you've specified.
On top of the JobHours::EmpID field put the related Employee::EmpName field. Set the field so that it cannot be entered in browse or find mode.
Now your users will see the Employee Name, but when they click that click will go through the top field and into the Employee ID field where they will choose the name from the value list.
pft's solution is one that I have long used, but I do still find it inelegant because the user still sees an existing id number in the field when changing the value.
If the type-ahead is important, I would use the popup menu. Once the menu has been activated either by tabbing into it or by clicking into it, the user is able to type from the keyboard and the selection will change based on what's entered.
I came to this thread looking for a solution to this same issue (allowing the user to pick from a list, show their choice, but store a related value instead). For example, choose a plant species name from a dropdown, show the plant species name in the dropdown field, but have it store the taxonomic serial number (TSN; which is more likely to stay the same over the years). This is easy to do in MS Access, but took a litlte more messing around to do it in FMP12.
How I solved it:
I created two fields in the table that would be storing the values: Plant_TSN and Plant_SciName. A relationship must exist between the values in these two fields. In my case, I store a SciName for each TSN in a lookup table. I then created two fields in my layout, one for each new field.
For the value you wish to store (ex. Plant_TSN):
Make the corresponding layout field a dropdown and include the show/hide arrow. Edit the value list you will populate the dropdown with to show the second (reader friendly) column but store the first column value. In the layout shrink the field to only show the arrow.
For the field you wish the user to see (ex. Plant_SciName):
make the other layout field a Edit Box and prevent field entry in either Browse or Find mode. But it up against the dropdown arrow created in the previous step to make what looks like one field.
Finally, back in the first field (arrow-only drop down) write a script to push the user friendly number (Plant_SciName) to the edit box when the user-ugly (Plant_TSN) value is picked in the drop down. I used the OnObjectSave script trigger of the dropdown formatted field. Script should be something along the lines of 1) Freeze window, 2) Go to Related Record (based on relationship in lookup table 3) Set Field (i.e. the edit box) and 4) GotoLayout[original] to offset the Freeze.
Probably not an entirely clear explanation, but I bet you will get it on your third read through! I would have posted a screenshot, but I apparently need 10 "reputation points".
Cheers.