Microsoft dynamics ax 2012 How to create autolookup from 2 different tables - axapta

I just realised that im facing huge problem on my project. I have 3 tables- slimnica(Hospital), nodala(Department) and telpa(Room). There are hundreds of Hospitals, Departments and rooms. When im filling table Room, i must select ID from table Department, but the problem is, one multiple hospitals can have example, Surgery department. It means, when im filling up Room table, i can put autolookup Departments name, but then it will show multiple Surgery departments. Is there a way to also show name of Hospital in autolookup? I added link down below of my tables.
Tables: Slimnica(Hospital), nodala(Department), telpa(Room)
Example:
I have 3 different hospitals, but all of them has Surgery department. When im filling up Room table, i must select what depertment it is, so i select departments id(it will show department name, because of autolookup name) and it will show me 3 options - id 1, surgery. id 2, surgery. id 3, surgery. Is it possible to make a autolookup that will also show hospital where that department is??? example - id 1, surgery, Childrens traumatology hospital.

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.

GSuite AppMaker - Populate datasource with distinct values from another table

I have a simple gsuite app with two data sources. One is a students datasource which stores student name, id, and demographic info. The other is a record of the attendance for the current day and contains name, date, and present (boolean column). Each student is unique and maps to one or more rows in the attendance datasource.
The goal is to be able to pre load the table with a set of students from the students table, leaving the date and present blank. THen the user can go down the table checking the boxes for who is in attendance on that day.
Is there a simple way to pre-load a set of records in the Attendance table based on the students table? Any good examples with explanation?
EDIT:
Here's what a data model might look like:
Students: FirstName:string LastName:string Status:string SiteName:string
Attendance: FirstName:string LastName:string Date:date Present:bool
The Students datasource would contain one record per FirstName, LastName. The Attendance datasource would contain multiple records per student, corresponding to each day that attendance data was captured.
Ideally, when displaying the Attendance table widget, I would pre-populate the table with a list of students for one Site. I already have a date-picker widget that updates all the date column values.

Database Schema for Parent-Child Relationships

I need to develop a database schema for a pediatrics database that allows the following:
Store last name, first name, date of birth, and gender for each patient.
Store all applicable guardians that may include mother, father, legal guardian and their relationship to the patient (child).
Identifies patient siblings and their relationship to the patient.
4, Allows for patients to become guardians/parents over time.
Stores phones numbers linked to each individual including patients and parents/guardians.
I'm really locked up on the best way to tackle this problem. I'm considering three tables, tblPatients, tblGuardians, and tblTelephones, but I think this would require multiple entries for parents who have multiple children. I'm sure this problem has been solved in the past, but I haven't found a suitable answer. Any insight would be appreciated.
Allows for patients to become guardians/parents over time.
This is key. If patients may become guardians/parents later, you should probably have a table for "person" that describes any kind of person, and then categorize that person with other tables.
For example
PERSON table defines demographics, (last name, first name, date of
birth, and gender, phone number etc)
PATIENT Table defines patient data with FK, and points to
a specific PERSON, optionally with a unique constraint on
PATIENT.PERSONID to ensure that no two patients are the same
person. Presence of a record in this table implies a PERSON is a PATIENT
RELATIONSHIP table links two PERSON records together and defines a relationship. Person1ID, Person2ID, and RelationshipType for example.
Here's my approach to the problem.
tbl_person, columns:
id
first_name
last_name
birth_date
gender
contact info
other personal info
tbl_patient, columns:
id
tbl_person_id
"other columns related to the patient like reason, symptoms, diagnosis, etc"
tbl_patient_has_guardian(one-to-many), columns:
tbl_patient_id(primary key)
tbl_person_id(primary key)
patient_relationship_to_guardian_type
mother, father, etc
So when adding a new patient record, add the personal info to tbl_person, then reference tbl_person id to tbl_patient.
tbl_patient_has_guardian, one patient can have multiple guardians. The guardians has specific relationship type assigned to a patient, it could be a mother, father, etc.

Microsoft Access Report

I have 2 tables: Customer and Sales. The customer table has:
Customer Number
Customer Name
Customer Location
The sales table has:
Customer Number
Sales Date
Sales Amount
I created the relationship between the tables based on customer number. I can do a query that links up the data from each table.
What I have not been able to do is to summarize my Access report.
I only want Customer Number, Customer Name and Customer Location to show up once and I want each Sales Date and Sales Amount to show up associated with that customer.
Right now, when I do my report, Customer Number, Customer Name and Customer Location gets repeated for each sale.
For instance, if Customer A has 3 sales, Customer A shows up 3 times. I want Customer A to show up once, with the 3 sales listed individually underneath Customer A.
I can summarize it by Customer Number (using a group, I think), but Customer Name and Customer Location still show up multiple times.
I appreciate any advice.
You need to put all fields that you want to show up once in the group header.

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

Resources