Infopath 2010 cascading dropdown show value when display names are the same - infopath

I have an InfoPath form where the user is supposed to choose a type. To do this, he must first choose a group.
I have done this using cascading dropdowns, where the types dropdown is filtered depending on the choise of group.
So far, all well.
As my data is now, i have 3 groups, one that contain all types that do not belong in any of the other groups. The other two groups are used to distinguish between types that are called the same, but have different IDs. Like so:
G1: Stuff we own:
Car - id1
Sofa - id2
Bed - id3
G2: Stuff she owns:
Computer -id4
Bike - id5
G3: Stuff he owns:
Computer - id6
Bike - id7
I have set the Display Value to be the title, and the Value to be the ID.
And here is my problem:
When I from the groups choose "Stuff he owns", and choose type "Computer", the display show "id4" when the dropdown is collapsed again.
If i change all G3 types to have diaplay name different from those in G2, it works as it should.
However, I am not at liberty to change my real data.

There must be something wrong with your filter. Are you using a lookup list? IF yes, the group should have proper mapping with the types so when you select the group, the corresponding types will show.
GROUP -- TYPES -- ID
We own -- Car -- 1
We own -- Sofa -- 2
We own -- Bed -- 3
She owns -- Computer -- 4
She owns -- Bike -- 5
He owns -- Computer -- 6
He owns -- Bike -- 7
On your filter, it should have Group name = GROUP, so it will only show the TYPES on your type dropdown based on the GROUP mapping.

Related

Invisible graphs cause report to slow

I have a report with a parameter where the end user chooses a practice name that corresponds to a group of people. Most of these groups have fewer than 10 people, but a small number of them have as many as 150. When there are more than 15 people in a given group, they want separate graphs, each with no more than 15 people. So for most of the groups, we only need one graph. For a few, we need a lot of graphs.
Behind the scenes, I created a graph for each multiple of 15 people, and set them to only be visible if there are actually that many people in the group. This does what I need it to, but it makes the report super slow. As close as I can tell, behind the scenes when an end user runs the report it's still somehow rendering the hidden graphs and slowing it all to heck. (I did find this link which I think suggests this is a known bug.
I need to have one report where the end user selects the practice name, so I can't make two reports, "My practice is normal" and "My practice is ginormous". I thought maybe I could make a conditional sub-report split into those two reports based on the practice name parameter, but that doesn't appear to be possible; you can play around with visibility but I'm guessing that will still cause the invisible graph rendering problem and not help my speed.
Are there any other cool tips I can try to speed up my report, or is this just a case of too many graphs spoiling the broth?
The easiest way would be to generate a group number for every 15 people and then use a list control to repeat the chart for each group.
Here's a very quick example of this in action. I just used some sample data from one of the Adventure Works sample database.
Here's my query that returns every person in each selected department. Note that I have commented out the DELCAREs as these were just in there for testing.
--DECLARE #Department varchar(50) = ''
--DECLARE #chartMax int = 5
SELECT
GroupName, v.Department, v.FirstName, v.LastName
, ChartGroup = (ROW_NUMBER() OVER(PARTITION BY Department ORDER BY LastName, FirstName)-1) / #chartMax -- calc which chart number the person belongs to
, Salary = ((ABS(CHECKSUM(NewId())) % 100) * 500) + (ABS(CHECKSUM(NewId())) % 1000) + 10000 -- Just some random number to plot
FROM [HumanResources].[vEmployeeDepartment] v
WHERE Department IN (#Department)
ORDER BY Department
The key bit is the ChartGroup column
ChartGroup = (ROW_NUMBER() OVER(PARTITION BY Department ORDER BY LastName, FirstName)-1) / #chartMax
This will give the first 5 rows in each department a ChartGroup of 0 the next 15 1 and so on. I used 5 rather than 15 just so it's easier to demo.
Here's the dataset results
Now, in your report, add a List, set it's dataset property to your dataset containing your main data (the query above in my case).
Now edit the 'details' rowgroup properties and add a grouping by Practice and ChartGroup (Department and ChartGroup in this example)
In the list box's textbox, right-click then insert a chart.
Set the chart up as required, in my example, I used salary as the values on a pie chart and the employee names as the labels.
Here's the final design ..
Note that I set the department as a multi-value parameter and also set the number of persons per chart (chartMax) as a report parameter.
When I preview the report I get this for 'Engineering' which has 6 employees
Sales has 18 employees so we get this
.... and so on, it will generate a new chart for every 15 people or part thereof.

Enter data in mother table using data from child tables

Hi all,
I have 3 tables in an access 2010 database:
Crew: CrewID; Name; Adres;...
Voyage: VoyageId; Voyage name; Departure harbour; Arrival harbour
Crewlist: CrewlistId, VoaygeId, CrewId, Rank
The VoaygeId and CrewId from the Crewlist table are linked (relation) to the autonumber ID's from tables 2 and 1.
My first and main question is: Upon boarding everyone has to ‘sign in’ selecting the voyage and there name, and assign them a roll (of to be donde by the responsible officer). How can I make a form that lets the users browse through the voyagenames and crewnames in stead of the ID’s uses in the ‘mother’ table (table 3: Crewlist)
2nd question: how can I make sure that someone isn’t enrolled twice for the same voyage (adding same voyagenumber and same crewId number in crewlist). This would preferably be blocked upon trying to add the same person a second time on a voyage.
To prevent duplicates in Crewlist, add a unique index to the table on both CrewId and VoyageId
It would be a good idea to add relationships and enforce referential integrity
You are now in a position to use the wizards to create a form based on Voyage and a subform based on CrewList with a combobox based on Crew
There are a number of refinements you could add.
Make sure you do not use reserved words like Name and do not put spaces in field names. You will thank yourself later.
See also create form to add records in multiple tables

Database schema for Assignment Website - Is this a Many-to-Many Relationship?

I am creating an asp.net website (through Expression Web 4 and Visual Web Developer 2010 Express), using a database created via Sql Server 2008. I am however stuck with regards to the database schema, which feeds into the website.
The website being created is to allow legal cases to be created, with the type of case being recorded and then have Lawyer(s) and/or Advocates and/or Support Staff recorded as working on the case.
So a case called 'Kramer v Kramer' will be a divorce case with 2 lawyers, 1 advocate and 4 support staff all working on the case. However another case 'The People v Larry Flynt' may be a prosecution case with 4 lawyers, no advocate and 10 support staff.
What I have done so far is that I have a table called 'Case Table' which contains the following columns:
Case_ID (this being the Primary Key for the table); Case_Type_ID; Lawyer_ID; Advocate_ID, and Support_Staff_ID. The last 4 columns in the Case Table are Foreign Keys.
The Case_Type Table simply has two columns: 'Case_Type_ID' (PK) and 'Area_of_law'. Case_Type_ID is simply numbers (001,002...) and 'Area_of_law' is char(30) (e.g. litigation, divorce, property, criminal). So far, so good.
The problem is (and this applies to the Advocates and Support Staff), if I create the Lawyer Table to simply have three columns:
Columns = Lawyer_ID (as the primary key) | First Name | Last Name
record 1 = 001 | Tom | Hanks
record 2 = 002 | Tom | Cruise
record 3 = 003 | Daniel | Craig
record 4 = 004 | Nicole | Kidman
how do I then assign multiple Lawyers to the case?
Within the Case Table, in order to comply with the normalisation rules, presumably I would need to add columns to the Case Table as described above so it records Lawyer_ID_1 (FK)| Lawyer_ID_2 (FK)| Lawyer_ID_3 (FK) | Lawyer_ID_4 (FK).
So it could be 004 | 002 | Null | Null to show Nicole Kidman and Tom Cruise were working on the case. If I only had one Lawyer_ID column, in order to show Nicole Kidman and Tom Cruise working on the case, it would have to be '004,002', which is a big no-no from what I have read on this website.
By recording all the lawyers in a separate table, I am able to to create a databound checkboxlist (bound to the Lawyer Table) in visual web developer 2010 express because it populates the list with the names of the lawyers. So I am pleased with this approach.
But if then had 50 lawyers within the Lawyer Table, I would need to have 50 columns in the Case Table assigned to just lawyers (if a Case ended up with 50 lawyers working on it). This approach is problematic as the Case Table may get skewed if lawyers are removed or added because the number of Lawyer columns become affected. Clearly this is a bad approach, so is anyone able to help?
Is there a database schema that would allow one 'Case' record to be related to multiple 'Lawyer' records, without numerous columns? (hopefully the schema can also be applied to the Support Staff Table and the Advocate Table).
Your help will be much appreciated. I am new to web development and sql database work and I've tried to look up the solution, but I probably don't know the keywords for my problem.
This is probably a many-to-many relationship. Allow me to explain the 3 relationships a little in your case:
If each case has only one lawyer, and each lawyer can only ever work on one case, then you have a one to one relationship.
If each case has only one lawyer, but each lawyer can work on multiple cases, then you have a one to many relationship. Likewise, if each case can have multiple lawyers, but each lawyer can only work on one case, then you still have a one to many relationship.
If each case can have multiple lawyers, and each lawyer can work on multiple cases, then you have a many to many relationship.
The typical solution to a many to many relationship is to have a third table to describe the relationship:
create table casesALawyerWorksOn (case_id, lawyer_id)
If #albert, #brad, and #christine work on a case #peopleVflynt, then:
insert into casesALawyerWorksOn (case_id, lawyer_id) values
(#albert, #peopleVflynt)
(#brad, #peopleVflynt)
(#christine, #peopleVflynt)
Thus, all the cases that a lawyer #fred works on are:
select case_id from casesALawyerWorksOn where lawyer_id = #fred
and all the lawyers that work on a case #kramerVkramer are:
select lawyer_id from casesALawyerWorksOn where case_id = #kramerVkramer

designing type 2 dimensions

I have a question about type 2 dimensions.
Within our HR system, it is possible to hire an employee with one date, and then at a later point in time, change the hire date if it had been entered incorrectly in the first place. This gets complicated when using Type 2 dimensions as the change would result in a new record in the dimension table.
So, I basically need a way to say that some updates (such as the one above) shouldn't result in a new record in the dimension table. But, for other instances such as if an employee moves to a new position, then I definitely need to create a record in the dimension table.
What are my options here?
A type 2 dimension doesn't need to apply to every attribute in the dimension. You can choose to make some attributes Type 1 which overwrites values and loses the history and some attributes Type 2 which creates the new record and retains history.
So in your example above you'd make the "Position" attribute type 2 and the "Hire date" type 1.
Check out this wikipedia link with a list of the different types of slowly changing attributes, http://en.wikipedia.org/wiki/Slowly_changing_dimension.
Most of the time you'll only need Type 1 and Type 2 tho.

Repeater with dynamic number of columns

Repeater with dynamic columns.
I have to show columns based of settings. Sometimes I want to show Name, Age, Sex, Salary. So the stored procedure will return
Name Age Sex Salary
-----------------------
Rauf 23 M 10
Amal 25 M 10
Sometimes I need to show Name and Salary only. So the data will be
Name Salary
------------
Rauf 10
Amal 10
How can I design a Repeater control to show this type of tables having dynamic columns ?
Unless perfomance i really crucial, I would take the easy way and use fixed columns (all of them) and just set visible=false in case you do not need them.

Resources