One to many relationship data addition for multiple level not working properly in MS Access - ms-access-2007

I have a MS Access application with four levels of one to many relationships. The levels are as below:
Scenario ->> Attractiveness->> Metrics->> Parameters
I have a set of attractiveness, metrics and parameters list all the data are independent. We can map one attractiveness with any number of metrics and for that metrics I need to map parameters. The first higher level is scenario so I am going to create scenarios. So for a scenario we can have only two attractiveness. Then for that two attractiveness user can map any metrics available. In the next level user need to select the parameters for given attractiveness->>Metrics levels.
Please find the below image of my relationship between these tables.
I am using the datasheet view to enter data for each level in a sub form. Please find the below data entry sub form
Please find the below relationship keys:
Scenario Table PK-> (Scenario ID with no Duplicates) -> Attractiveness Table FK ->(Scenario ID with Duplicates)
Attractiveness Table PK ->(Attractiveness ID with no Duplicates) - > Metrics Table FK->(Attractiveness ID with Duplicates)
Metrics Table PK ->(AttractivenessMetrics ID with no Duplicates) - > Parameter Table FK->(AttractivenessMetrics ID with Duplicates)
I can able to add level by level (i.e adding attractiveness, Metrics then update the attID, MetricID, attMetricID in Metric table) then add parameter level is working fine. But if I add parameter without updating the previous metric level then all the parameter are added into the first metric. Since I have no AttractivenessMetrics ID combination in Metrics Table.

I fixed the above issue by using form timer control to keep track of the active control. So while users moving into parameter level updation form metrics level then it will update the metric tables fields this will fix the no parent issues in parameter level. It works well and easy to update the data.

Related

Oracle APEX: Assign primary key as interactive grid ROWID, Use select Interactive Grid ROWID in SQL query

To preface -- I am as green as at gets.
I am tasked with building an app for internal org use. We have a DB with patient data, and in interface with a hospital electronic medical records system. patient data entered into the EMR is sent to us via interface to update the patient profile in our database. Partial matches require manual intervention.
Message is received in a table within a staging schema
attempts to match to existing patient
if there are only 'partial matches' a status is set to 'mismatch'
I want to:
Display a summary of all 'mismatch' status records. I want to use an interactive grid to select individual records.
Set ROWID of interactive grid rows to the respective primary key of the record in the staging table.
Use the selected Interactive Grid ROWID (user selects a specific record in the interactive grid) to select the matching primary key of the corresponding record in staging table to create SQL query to find potential matches within our DB. Potential matches are displayed in a second table.
Questions:
How do I set the rowID of an Interactive grid to the unique key column of the staging table?
--Some research shows I need a hidden item, is this correct?
How do I access a rowID that has been selected in the Interactive grid to use in a SQL query?
My humble thanks and appreciation
So, your question is a bit confusing, but as far as I understand it. You are getting some data from table A, trying to match it with table B. If it matches, it irrelevant for us. If a match is not found you want to show it so that it can be manually matched.
In apex in order to update a table, you need to select what is the primary key by which it will update the data. That is usually a column in the table, but it can also be rowid(just include it in the SQL like any other column).
What I would suggest for you from what I understand of your situation.
Display the mismatched rows in an interactive grid, with rowid as primary key. Then you will need to have a column by which you match, if these entries already have some sort of key by which you tried to match but failed, display that. And have that column be a PopupLOV so the user can edit what value is in that field and set it to the appropriate match. One thing you will need to be careful about. You are editing a Unique key, or perhaps even Primary key, you might get conflicts here. Even if you only display unmatched data in the LOV, you can still have a user editing multiple rows and trying to match two rows to the same value, that will fail with an error that isnt particularly user friendly.

SAP Business objects how to create different kinds of join between different data providers

I have two data providers. One is a universe, one is an excel file. Excel file has column ID. I want to find ID,JOB_ID, Cost
I have created a merged dimension:- ID. When I create report with ID and Cost, I'm getting an outer joined result which is what I want. But when I add another attribute from universe it is being inner joined result. Where can I control this feature
You are ever so close. Here are the basics when working with a zero or one to many relationships. Credit for this goes to this blog post. I am copying it here if perchance that link goes dead.
As a rule of thumb , when trying to merge DP’s with a 1xN relationship
:
Merge the common fields
Use the dimension coming from the N side query
Create detail variables from the 1 side query for each dimension needed with associated dimension equal the merged dimension
Check "Show rows with empty dimension values" on Table formatting for each table using dimensions coming from both queries.
Here is a screen shot to highlight where to find the setting in step #4.

designing a database schema for aws mobile backend

I am new to databases and sql and would like to design a database for a fitness app that will keep track of workouts at the gym.
In my app, I have designed a custom workout object that has a name (e.g. 'Chest day'), an ID (some number) and a date (string). Each workout object contains an array of exercises, another custom object, that has a property for called 'set'. The set is also a custom object with only two numeric properties: number of reps and weight (e.g. 10 reps at 50 lbs)
What I thought of is to have one table for the workouts, another for the exercises and another for the sets. The problem is I do not know how to connect the tables (i.e. link multiple exercises to a unique workout and link multiple sets to a unique exercise) and am not sure if this is even the correct approach.
Also, I planned to set up the backend for this app using the amazon web services mobile hub which provides a noSQL database.
In NoSQL, you should keep all the attributes in single table. You shouldn't normalize the data like RDBMS. Also, please try to come away from Join. The main advantage of NoSQL is that keep everything as one item, so that you don't need to Join to get the result.
Advantages of this approach are:-
1) Fast response as all the data is present as one item in a table
2) Schema less database i.e. you can add any attributes at any time (i.e. no need to alter table and add the new columns)
DynamoDB design for above use case:-
The combination of partition and sort key should be unique
name -String (Partition Key)
id -Number (Sort Key)
date - String
exercise : [array of values] - List data type
custom_set : {rep : 1, weight : 2} - Map data type
Important Note:-
The important thing while designing the data model for DynamoDB is all the data retrieval use cases (i.e. Query Access Patterns) should be available to design the appropriate model.

Implement a multi level outline structure

I need to setup and manage a multi level outline structure for requirements management in Microsoft Access 2013.
outline needs to work much like a word outline where each record can have only 1 parent, but can have 1 or more siblings (sibling order does matter) and 0 to many children.
Need to support as many outline levels as possible, current data exceeds 15 levels but is being reduced where possible.
need to be able to determine if a record has children, has siblings, and what is its parent.
need to be able to delete all children of a record when a record is deleted.
need to be able to add new records either after or below a record in the outline structure
need to be able to renumber the outline when adds, deletes, copies, and moves are done within the outline structure.
current approach is a table which contains a unique ID, 15 numeric fields for each individual level # of the outline #, and using a sort of the numeric fields to organize into the outline order.
running into several question related to this situation:
is this the best data structure approach or should I move outline info to a separate table?
given that I am in a query with an outline order sort, can I write a VBA function as a calculated column to determine a record's parent, if it has siblings, and if it has children.
is it possible/practical to perform an sql select in vba to query the same table/query I am in to get a records parent, children, siblings, as a calculated column?
is it possible to use data triggers to support any management of this outline structure.
Example of the outline structure:
1
1.1
1.1.1
1.1.2
1.1.2.1
1.1.2.2
1.1.3
2
2.1
2.2
2.3
2.3.1
2.3.1.1
2.3.1.1.1
This ain't going to be at all trivial in Access. For maximum flexibility in the number of levels I would not use separate fields for the level numbers but would instead have a self-referencing table with columns ID, NodeNumber, OutlineNumber, ParentID (NodeNumber would be a single number indicating which sibling this record is under a given parent - 1, 2, 3 - and OutlineNumber would be the full Outline reference for this record - 1.2.1, 1.2.2, 1.2.3). You would use the ParentID to identify a record's parent; query all records with the same ParentID to find siblings; query records where the ParentID = current record's ID to find children. You're going to have to write some serious VBA code to control inserts, updates and deletes, and definitely don't let people add data manually into the table. Unfortunately Access does not have data triggers.
[EDIT] Apparently I'm wrong! Access does have an equivalent to SQL-Server "trigger" functionality called data macro, but I've never used it. Maybe this could help you?

Recursive Table How Reference To Load Data?

I am planning on using a recursive table in my data model so that I can support an undetermined number of children that can live under a parent. My example is a Table of Contents where I don't know how deep my subsections will be under a chapter.
The issue I am stumbling over is what techniques do folks use to populate there DB once they have defined a recursive table? By that I mean if I have a list of items that refer to a chapter -> Section -> Subsection...when I load the Chapter, Section, and Subsection into the model I need to identity the lowest level of the hierarchy and assign that value to the Item I am loading (Foreign Key - I would assume) so that I can always get all of the info about that item.
So for example:
Item: 2A-GHI: Chapter: 2 Section: A SubSection: GHI
If I have my data loaded like
ID|TOCID|TOC_VALUE|PARENT_ID
1|Chapter|2|-1
2|Section|A|1
3|SubSection|GHI|2
How do i tie the item to GHI so that I can set the FK to the Recursive Table for that Item?
Do you use all three values as a Key and set that as another column in the table so that on load you can identity the lowest level?
Like So:
ID|TOCID|TOC_VALUE|PARENT_ID|Key
1|Chapter|2|-1|2
2|Section|A|1|2_A
3|SubSection|GHI|2|2_A_GHI
I can load the recursive table and I am using a CTE to recurse the data, but I am not sure what the best method is to load the recursive data and tie that data into the model so that my item has a FK to the Table of Contents data.
You need a column for the row's parent ID.
ID|TOCID|TOC_VALUE|parent
1|Chapter|2|0
2|Section|A|1
3|SubSection|GHI|2
a parentID of 0 or null means it's a root (chapter) node