Is possible to join a dimension to an OLAP cube using fields that do not have a foreign-key relationship in the underlying relational DB?
Yes it is possible. It is called logical relationship and is defined in DSV - data source view. Just drag a many side field (logical FK) from one table to logical PK field of another table.
Related
Is it possible to manage a cascading relationship in icCube? For example, if I have the following 3 tables:
(1) NameID, FuelID
(2) FuelID, ScheduleID
(3) ScheduleID, DateTime, Value
Can I tie the NameID from table (1) to Value in table (3)
You can do this using a Javascript View. You can check the documentation here how to do this, the idea is that the 'main' table is the big one and the small ones, that should behave as lookup tables, are the 'cached' tables.
hope it helps
I a modeling an OLAP cube using Modrian Workbench Schema and using Jaspersoft to present it. The cube is built upon a fact table with FKs to dimension tables.
Currently my fact table has nullable foreign keys to the dimensions, which I personally find interesting (and, as far as I know, it is just s styling decision whether to use nullable or not nullable FKs ( https://dba.stackexchange.com/questions/3512/fact-table-foreign-keys-null ).
The problem is that when selecting ALL States (State is a dimension in my design), I get only the records that have a state, not the records without states (in which the state id is null).
Is Mondrian capable of getting the rows that have not state id information? How can I define that?
I think you'll have to go with non-nullable FKs and a none / n/a / unknown etc. member if you want the ALL member to refer to all facts.
If you later want to write queries that only consider rows with real dimension values, you can exclude the none member again.
I have a table of items that each reference one other item in another table. We'll say the items are people, and the related items are favorite foods.
Table A: Bob:1, Sally:1, Sue:3
Table B: 1:Apples, 2:Bananas, 3:Oranges
The "people" are tied to their favorite "foods" by the food RecId, refererenced in the People table.
I have a form/grid for editing people. Is there a way to cause the FoodRecId StringView in the grid to convert its value so the RecId numbers are not visible in the grid?
I've already written multi-column lookups to easily handle creating correct relations, but if the RecIds in the grid could be hidden/replaced, the form will be much easier to use.
Way easy if you are using AX 2012: use surrogate keys.
Use of RecId as foreign keys are now Best Pratice!
Update: The exact steps can be found in AX Musings.
If using an older version of AX then have a look on the use of ContactPersonRecId in the CustTable form.
It involves hiding the recId field in the form while using another edit field ContactPersonName as the key.
While the use of RecId as a foreign key is not against Best Practice it is usually avoided due to the complexity of manually handling surrogate keys.
Brad,
ReplacementKey is the solution for you.
It is possible now in AX 2012 to define parent/child relationship without having to define the same primary key in both the tables. For eg, till AX 2009, a header/lines relationship used to exist on the basis of a unique key like SalesId field in both SalesTable and SalesLine. This is no more required in AX 2012. Such relations are defined on RecIds and values are displayed on forms depending on what is defined on your ReplacementKey (thats why the name Replacement!)
Instead of RecId, you can show any other filed like name.
Check out my blog!
http://amannain.blogspot.in/2012/04/table-relationships-learning-with.html
I am facing a big problem with simple linq query.. I am using EF 4.0..
I am trying to take all the records from a table using a linq query:
var result = context.tablename.select(x=>x);
This results in less rows than the normal sql query which is select * from tablename;
This table has more than 5 tables as child objects (foreign key relations: one to one and one to many etc)..
This result variable after executing that linq statement returns records with all child object values without doing a include statement..
I don't know is it a default behavior of EF 4.0 ..
I tried this statement in linqpad also..but there is no use...
But interesting thing is if I do a join on the same table with another one table is working same is sql inner join and count is same..but I don't know why is it acting differently with that table only..
Is it doing inner joins with all child tables before returning the all records of that parent table??
please help me..
This table has more than 5 tables as
child objects (foreign key relations:
one to one and one to many etc)..
This result variable after executing
that linq statement returns records
with all child object values without
doing a include statement..
So we are probably talking about database view or custom DefiningQuery in SSDL.
I described the same behavior here. Your entity based on joined tables probably doesn't have unique identification for each retruned row so your problem is Identity map. You must manually configure entity key of your entity. It should be composite key based on all primary keys from joined tables. Entity key is used to identify entity in indenty map. If you don't have unique key for each record only first record with the new key is used. If you didn't specify the key manually EF had infered its own.
The easiest way to troubleshoot these types of issues is to look at the generated SQL produced by the ORM tool.
If you are using SQL Server then using the SQL Profiler to view the generated SQL.
From what you are describing, a possible explanation might be that your relationships between entities are mandatory and thereby enforcing INNER joins instead of LEFT OUTER joins.
I am using Visual Web Developer and Microsoft SQL server. I have a tag table "Entry_Tag" which is as follows:
entry_id
tag_id
I want to make the entry_id and tag_id pairing unique. A particular tag can only be applied to an entry once in the table. I made the two columns a primary key. They are also both foreign keys referencing the ids in their respective tables. When I dragged the tables into the Object Relationship Designer it only showed a relationship line between either "Entry_Tag" and "Entry" or when I tried again between "Entry_tag" and "Tag".
The "Entry_tag" table should have a relationship with both "Tag" and "Entry".
How do I go about doing this?
In general, you can add a unique constraint on the table that includes both columns. In this case, including both of the columns in the primary key should have already done this. If you have relationships set up for each field to other tables, then I believe those relationships should be displayed in the query designer... I see no cause for this given the information you've provided - perhaps you need to post more information.
Create an UNIQUE INDEX to for entry_id and tag_id.
CREATE UNIQUE INDEX index_name ON table (entry_id, tag_id)