Cognos framework join issue - entity-framework

I have a issue in cognos framework, here is the below explaination for the same.
I have a two tables.
1. SMRDLRD
2. F_SVC_HSTRY
DEALER table contains a dim column for dealer code keys.
SERVICE HISTORY table contains 2 dim columns for delaer code keys. (1st dim for service dealer codes and 2nd dim is for repair dealer code.. here,one service dealer code have many repair dealer code)
And now I have a requirement where I have to perform below join
SMRDLRD.I_DLR_DIM = F_SVC_HSTRY.I_CURR_FLET_DIM
AND
SMRDLRD.I_DLR_DIM = F_SVC_HSTRY.I_CURR_REP_DIM
But here I m not able to join one dim column on both the dim columns of other table.
However I had tried creating alias of a SMRDLRD table ,but the catch is SMRDLRD has so many other reference /lookup tables(say LKUP_CNTRY, LKUP_DOM etc ).
And that is where I m not able to bring all this tables into the picture.
Any help would highly appreciate.
Please let me know in the comment section if you need more information on this.
Thank you.

Related

Do ampersands work for user input in reports?

I have a working query that goes something like this:
Base table ACCT, link to others (listagg/subqueries) and ensure matching year("rollyear") field. Then the final step is to say which year ACCT table is in.
SELECT
FROM table ACCT
FULL OUTER JOIN table TABLE2 on ACCT.id = TABLE2.id and ACCT.rollyear= TABLE2.rollyear
...
FULL JOIN table TABLE7 on ACCT.id = TABLE7.id and ACCT.rollyear= TABLE7.rollyear
where ACCT.rollyear = extract (year from sysdate) +1
I typically use the calendar year plus one. I've been playing with using ACCT.rollyear = &rollyear to get user input... The limitation/issue I have is getting that running using the "User Defined Reports" feature.
Am I using this feature correctly? Does that only work for SQL Queries and not reports? Ive seen videos/comments about Stored Procedures and using "Accept...." but my attempts to mimic give errors and I'm not sure I'm on the right track. Thanks for any advice.
Change your query to use a bind variable:
where ACCT.rollyear = :rollyear
Then in the 'Binds' section you will see a variable with that name:
When you run your query you'll then be prompted to supply the value:

data merging in Tableau

I have two sheets in excel. One has CBG (neighborhood) IDs as shown below.
The second sheet has state and county names and IDs as shown below.
Now the first 5 digits in the CBG ID are just the corresponding state and county IDs for that CBG.
I need to to join this data together in Tableau so that I would have the state and county on the CBG sheet for each CBG.
Basically I tried to blend the data and it didn't work. I also tried to perform a join calculation using the 5-digit code in the second sheet and the LEFT function to extract the 5-digits in the CBG code but it didn't seem to work either.
To fix it, just needed to fix the Join calculation on both sides of the join.
Also, it seems that both variables to be joined need to be the same data type.
The data that you analyze in Tableau is often made up of a collection of tables that are related by specific fields (that is, columns). Joining is a method for combining the related data on those common fields. The result of combining data using a join is a virtual table that is typically extended horizontally by adding columns of data.
When joining tables, the fields that you join on must have the same data type. If you change the data type after you join the tables, the join will break.
Please go through the below steps for joining tables:
In Tableau Desktop: on the start page, under Connect, click a connector to connect to your data. This step creates the first connection in the Tableau data source.
In web authoring: Select New Workbook and connect to your data. This step creates the first connection in the Tableau data source.
Select the file, database, or schema, and then double-click or drag a table to the canvas.
Double-click or drag another table to the canvas, and then click the join relationship to add join clauses and select your join type.
Add one or more join clauses by selecting a field from one of the available tables used in the data source, a join operator, and a field from the added table. Inspect the join clause to make sure it reflects how you want to connect the tables.
When you are finished, close the Join dialog.
Thank you.

MS Access link record from forms

There are two tables, one for Student and one for Borrowed Books. In the Microsoft Access (2010, 2013), it is easy to display a form Student based on the table Student, and other form BorrowedBooks based on the table Borrowed Books with their Record Source pointed.
How to do Form BorrowedBooks showing records for the current student showing on the Form Student one at one time? I'm looking to learn both VBA script and using the built-in controls to achieve the result.
Relationship between has been built. And it's one student to many books relationship.
One VBA approach like:
DoCmd.OpenForm "BorrowedBooks", , , "StudentID = " & Me.StudentID
The real trick is figuring out which event to put code into.
Another option is to use form/subform arrangement - main form bound to Students table and subform bound to BorrowedBooks. Have you looked at Microsoft Lending Library database template?
so if my understanding of your question is clear then you need to join operation on the tables
SELECT *
FROM
student
INNER JOIN borrowedbooks ON (The two table'S related column ie student.pk=borrowedbooks.fk)
you can also add a where clause if you want from here you can state you primary key in student table and it relationshi

Trying to design form to query and edit records Access

I'm trying to make an Access database where we can scan in a list of bar-codes, batch edit information for them, then save all the records. Later, they will need to be scanned again to batch edit more information such as shipping and order numbers.
Does anyone have suggestions on how to best design this? To start with, I've (1) made separate tables for "orders" and "parts" and (2) created a form of text boxes and a button attempting to apply this info to a part subform where records are created via the bar-code scanner. I'm a rather new Access designer. Thanks!
The questions are:
I'm not sure how to query these records via the bar code (Part_ID field) to apply order information to them later.
I can't currently update all new part records at once through my form.
Here's a little guide on how to do it. Let me know if you have any questions.
Dim db As DAO.Database
Dim Rs As DAO.Recordset
'Here is an example of a vba qarry in access. tblOrdersWhere is obviously your table.
'orderNum is a column name in your table pref a primary key
'txtOrderNum.Value is the value of a text box
'If you want just a simple select * from table you can put after db.OpenRecordset("tblOrders")
set rs = db.OpenRecordset("Select * from tblOrders Where orderNum like '*" & txtOrderNum.Value & "*';", dbOpenDynaset)
'This is how you update records in Access
'If you want to update it's Rs.Edit instead of Rs.AddNew
Rs.AddNew
Rs("OrderItem").Value = txtGroupName.Value
Rs("OrderTime").Value = txtGroupNum.Value
rs.Update

changing a record to a different area

I hope yo can point me in the right direction.
I have a SSRS report organized by Continent/Country/Customer and I need to change (force?) some of the customers to appear in a different region/country from the DB. ie:
I have a local NZ customer in the right Region/Country (australasia/New Zealand) but I want this one to show up in a different Region/Country namely (Asia/China) as this customer buys locally but exports all to China.
There are some others customers that needs to be manually organized, following the same criteria, of course.
any idea on how can I do this?
and will be the best option to do it through SQL-Server or SSRS?
Thanks in advance.
Eric
I would create a new table called something like AreaOverride with the following columns:
CustomerId
Continent
Country
Then link to this in your query using a left outer join and replace the Continent and Country with the overridden values if they exist:
Select CustomerId,
Case when AreaOverride.Continent is not null then AreaOverride.Continent else Customer.Continent end as Continent,
Case when AreaOverride.Country is not null then AreaOverride.Country else Customer.Country end as Country
From Customer
Left outer join AreaOverride On AreaOverride.CustomerId = Customer.CustomerId
You might want to make this a view if you are going to use it in several reports or other places.
Then whenever you need to override a customer's details you simply add a row for them in this table and the values will be overridden in your reports.
Note that if you are dealing with a vendor database rather than your own you don't want to be messing with their database structure but you can still do this by creating a new database and put the AreaOverride table in it. Then you add the database name to your join. For example if your database was called MyStuff then your join looks like this:
Left outer join MyStuff.dbo.AreaOveride On ...