Engineering adds columns for relation
I'm absolutely can't understand logic of the forward engineering process.
Why it adds ADDITIONAL PK columns into my tables with relation?
For example, two tables: CLASS (class_id, name) and TYPE(type_id, name, class_id) with 1-N relation (class.class_id - type.class_id).
After engineering logical model into relational, in a last one I can see new columns:
class.class_id1, type.class_class_id1
How to avoid it? I want to use my own columns for relation!
Hi,
you don't have a primary key for entity CLASS in logical model - that's fine. However in relational model you need a PK existing in CLASS table in order to have foreign key from table TYPE to table CLASS.
So new surrogate key column is created - default naming template is {table abbr}_ID and since you don't have table abbreviation it takes table name and creates column CLASS_ID and it becomes CLASS_ID1 because you already have a column CLASS_ID.
For table TYPE - foreign key column is created referring to column CLASS_ID1 - default naming template is {ref table}_{ref column} - this is how the name for the column is set to CLASS_CLASS_ID1.
If you don't want to create primary identifiers in logical model then you should not add PK and FK attributes in related entities - PK/FK columns will be created automatically during engineering to relational model - you need to set related templates.
Otherwise you can create PK identifier and related attributes added to it and FK attributes will be maintained automatically.
Philip
Similar Messages
-
How to add columns for existing table dynamically?
Hi,
I created table structure only. I want to add columns for this existing table. Columns are not fixed, according to the user choice i need to write code.
Plz give me reply asap.
Thanks
ShirishaHi Shirisha,
I think the following code snippet will help you.
int l_no_cols = 0;
//Get the number of columns in this variable, something like the following
//l_no_cols = wdContext().currentContextElement().get<Context_attribute_name>;
IWDTable l_tab;
IWDTransparentContainer l_tbl_cont = (IWDTransparentContainer)view.getElement("TableDataCont");//ID of Container
l_tab = (IWDTable)view.getElement("TableData");//ID of Table
l_tab.setVisible(WDVisibility.VISIBLE);
l_tab.bindDataSource(wdContext.nodeTable_Data().getNodeInfo());
for(int a = 1; a <=l_no_cols; a++)
//Creating the column
IWDTableColumn l_tab_col = (IWDTableColumn)view.createElement(IWDTableColumn.class,"COL"+a);
//Creating Caption for Column Header
IWDCaption l_tab_cap = (IWDCaption)view.createElement(IWDCaption.class,"Caption"+a);
l_tab_cap.setText("Col"+i);
l_tab_col.setHeader(l_tab_cap);
//Creating Table Cell Editor for column
IWDInputField l_tab_cell = (IWDInputField)view.createElement(IWDInputField.class,"CellEditor"+a);
//creating context node attribute for the column dynamically
wdContext.nodeTable_Data().getNodeInfo().addAttribute("Col"+i,"com.sap.dictionary.String");
l_tab_cell.bindValue(wdContext.nodeTable_Data().getNodeInfo().getAttribute("Col"+i));
l_tab_col.setTableCellEditor(l_tab_cell);
l_tab.addColumn(l_tab_col);
l_tbl_cont.addChild(l_tab);
Regards,
Alka -
KMTL - How to add Column for OVER DUE DAYS in report
Dear Concern,
We are Microsoft Dynamics NAV 2013 users, We want a little change on Reminder Report (In report there is due date we inserted column for OVER DUE DAYS right side to Due Date column in we required Expression of which type of formula that
shows us the Over Due Days for particular.
Please every one confirm or suggest for this error.
Thanks & regards,
Laxman SonarHi Laxman Sonar,
Per my understanding that you have an date field(Due Date) in the report and now you want to get the over due days based on this field and display at right of the date field in the report, right?
I have tested on my local environment that we have two method to do this, one is to add the datediff functon in the query to get the overdue days and another method is to using expression in the report.
Details information below for your reference:
Method one:
Modify the query as below to get the new field(OverDue Days):
SELECT DueDate, DATEDIFF(day, DueDate, GETDATE()) AS OverDueDays
FROM tableName
Method Two:
Add an calculated fields and then add the expression below to get the value for this field or just add expression directly in the new field:
=Datediff("d",Fields!DueDate.Value,Today())
If your problem still exists, please try to provide us some sample date and more details information about your requirements.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
How to add columns for wad in web apllication designer
hi,
can any one tell me how to add new columns for analysis item in wad.
i found an option of adding new rows but not able to find a option of new columns in analysis item.
please suggest me.
i will assign pointsHi,
There is no functionlaity to add new columns.
For adding new combinations to the transaction data, the input ready new rows are used. Why do you need new columns? -
Add column for System OU name to report under Software Updates - C deployment states
I would like to add a column with the System OU name for the States 1-Enforcement state for a deployment report under Software Updates -C Deployments states. I do not know sql. Can someone please let me know that code I need to add to the
report so I can get this information? Any help would be greatly appreciated. SCCM 2012 R2 environment.
MLStevUse the SQL Report Builder to do that.
-
(ABAP-HR) To add columns for validity duration of any qualification
Hi,
We have a standard program RHXPEP01 which outs the employees , their qualification , required or not, they have passed it or not.
And we have also a standard Program RHXPE_EXPIRED_QUALI that outs details with validity of the qualification.
I would like to enhance the ALV report generated by RHXPEP01 to add two more columns in the list that will add validity start and end date of all /some qualifications.
Thanks,
Sourya Prakash..
-
How to delete or add columns in a DataTable.
Hi,
I need to delete/add columns for a DataTable programaticaly... Can anyone help me in this ??. In source code I added a datatable and lets take 3 columsn I added. While running application, I need to delete and add columns whenever I want.
Please help me....can you give a sample code for this... I really want
this code...
just to re-confirm you, I want to add or delete
columns not rows...I don't have sample code, why don't you give it a try? -
HOW TO: Add /manipulate columns for a GridControl
HOW TO: Add /manipulate columns for a GridControl when the columns (attributes) are from different entity objects.
This HOWTO describes the basic steps of using attributes from different entity objects for a GridControl.
One way you can create a GridControl which contain attributes from different entity objects is to create a view object and base it on the entity objects which contain
the desired attributes.
Here are the basic steps:
1.Create a new view object (or use an existing view object) by selecting File>New from the menu, clicking the Business Components tab and double-clicking
on the View Object icon.
2.In the View Object wizard change the name to something meaningful.
3.Select the entity objects you will base your view object on.
4.Nivigate to the attribute screen and select the attributes you would like to include in your view object from each entity object. At this point you can also create
a new attribute by clicking the "New" button. The new attribute can be a concatenation of other attributes, derived from a calculation etc.
5.In the query panel of the View Object wizard, click "Expert mode" and enter a query statement. You write complex queries such as decoding a set of attribute
values.
6.Add your newly to your newly created view object to the application module by double-clicking on the application module in the navigation pane and selecting
your view object from the list.
7.Create a new row set.
8.Bind row set to a query by editing their queryinfo property and selecting your view object and its attributes from the queryInfo pane.
9.Create a GridControl and bind it to the row set by editing the dataItemName property of the GridControl. Since the GridControl is bound at the row set level
all of the related attributes are automatically added.
nullMichael,
Are you intending this as a commercial solution or a work around?
To take an existing equivalent, one would build a view in the database tailored for each grid in an Oracle Forms application. Or a separate query layered over tables for each form/grid in a Delphi or Access application? Even if it is ninety nine percent the same over half a dozen forms/grids?
And now you've added a whole slew of "slightly different" rowSetInfos to maintain.
So if you wanted to add a column that needs to appear everywhere... you've just increased the workload multi-fold?
That would be a management nightmare, wouldn't it? Not to mention yet more performance cost and a slower system?
Hmmmm..... I'm not sure I like where this is headed... someone needs to do some convincing...
null -
How To Add a new column for ZPR0 price in open sales order report ??
HI,
my requirement is To Add a new column for ZPR0 price in open sales order report if the order/scheduling agreement is a cross-company code transaction l(company code of order/scheduling agreement <> company code of delivering plant), price = ZPR0 price as at estimated GI datek
-
To Add a new column for ZPR0 prce in open sales order report
HI,
my requirement is To Add a new column for ZPR0 prce in open sales order report if the order/scheduling agreement is a cross-company code transaction l(company code of order/scheduling agreement <> company code of delivering plant), price = ZPR0 price as at estimated GI dateHI,
my requirement is To Add a new column for ZPR0 prce in open sales order report if the order/scheduling agreement is a cross-company code transaction l(company code of order/scheduling agreement <> company code of delivering plant), price = ZPR0 price as at estimated GI date -
How to add a default value in a site column for every item in a document library
HI
i created a content type with some site columns ,
and included in a Document library.
Process ( content type)
-ProcessNo
-ProcessName
after that i uploaded 100 Documents but not added value in a site column process name.
now how i add a default value in a site column for every document in a document library
adilHI
i get below error when i change the script
PS C:\scripts> C:\Scripts\updatedefaultvalue.ps1
Cannot index into a null array.
At C:\Scripts\updatedefaultvalue.ps1:8 char:7
+ IF($i[ <<<< "Title"] -eq $null)
+ CategoryInfo : InvalidOperation: (Title:String) [], RuntimeExce
ption
+ FullyQualifiedErrorId : NullArray
$web = Get-SPWeb http://tspmcwfe:89/
$list = $web.Lists["test"]
$item = $list.Items | Where { $_["Name"] -eq "Emc" }
foreach($i in $items)
IF($i["Title"] -eq $null)
$i["Title"] = "test"
$i.Update()
adil
Why are you piping a where in the items? Do you only want to add the "test" to ones matching
a name?
If you have ISE installed on your server I recommend you put your code in there and debug it.
If this is helpful please mark it so. Also if this solved your problem mark as answer. -
Add a new column for WBS description
Hi all
how to Add a new column for WBS description and derive the value as per the FS
anybody can provide document for thisHi ,
In Table <b>PRPS</b>, alread you have short description field <b>POST1 and POSTU</b> for the WBS element, apart from that still if you want to include a feild for your own requirement , then create a structure and with the description field of your requirement and append that structure into PRPS table.
Hope This Info Helps YOU.
<i>Reward Points If It Helps YOU.</i>
Regards,
Raghav -
How to add one column for entry in the TLB screen?
Hi all,
Does anybody know how to add a customised column for free text in the TLB header screen? The reason is user needs to add ship or container no. This info will be later on interfaced via CIF exit to R/3.
I think many of you have the same requirement.
Thanks heaps!Thanks Digambar,
Can you help to work out more detail on how to customize the code in the TLB screen?
Are you thinking of adding one field in the table and making the ALV grid control editable? If you have any reference doc/link to do it, it would great!
Cheers, -
Help for a query to add columns
Hi,
I need for a query where I should add each TableC value as an additional column.
Please suggest...
I have 3 tables (TableA, TableB, TableC). TableB stores TableA Id and TableC stores TableB Id
Considering Id of TableA.
Sample data
TableA :
ID NAME TABLENAME ETYPE
23 Name1 TABLE NAMEA Etype A
TableB :
ID A_ID RTYPE RNAME
26 23 RTYPEA RNAMEA
61 23 RTYPEB RNAMEB
TableC :
ID B_ID COMPNAME CONC
83 26 Comp Name AA 1.5
46 26 Comp Name BB 2.2
101 61 Comp Name CC 4.2
Scenario 1: AS PER ABOVE SAMPLE DATA Put each TableC value as an additional column.
For an Id in TableA(23) where TableB contains 2 records of A_ID (26, 61) and TableC contains 2 records for 26 and 1 record for 61.
Output required: Put each TABLEC value as an additional column
TableA.NAME TableA.ETYPE TableB.RTYPE TableC_1_COMPNAME TableC_1_CONC TableC_2_COMPNAME TableC_2_CONC
Name1 EtypeA RTypeA Comp Name AA 1.5 Comp Name BB 2.2 so on..
Name1 EtypeA RTypeB Comp Name CC 4.2 NULL NULL
Scenario 2: If Table C contains ONLY 1 row for each Id in TableB, output should be somewhat
Output:
TableA.NAME TableA.ETYPE TableB.RTYPE TableC_1_COMPNAME
TableC_1_CONCvalue value value value valueHi,
Welcome to the forum!
Do you want the data from TableC presented
(1) in one column, or
(2) in several columns (a different column of results for each row in the original TableC)?
(1) Is called String Aggregation and is easier than (2).
The best way to do this is with a user-defined aggregate function (STRAGG) which you can copy from asktom.
Ignoring TableA for now, you could get what you want by saying
SELECT b.rtype
, STRAGG ( c.compname
|| ' '
|| c.conc
) AS c_data
FROM TableB b
JOIN TableC c ON b.id = c.b_id
GROUP BY b.rtype;(2) Presenting N rows of TableC as it they were N columns of the same row is called a pivot. Search for "pivot" or "rows to columns" to find examples of how to do this.
The number of columns in a result set is hard-coded into the query. If you don't know ahead of time how many rows in TableC will match a row in TableB, you can:
(a) guess high (for example, hard-code 20 columns and let the ones that never contain a match be NULL) or,
(b) use Dynamic SQL to write a query for you, which has exactly as many columns as you need.
The two scripts below contain basic information on pivots.
This first script is similar to what you would do for case (a):
-- How to Pivot a Result Set (Display Rows as Columns)
-- For Oracle 10, and earlier
-- Actually, this works in any version of Oracle, but the
-- "SELECT ... PIVOT" feature introduced in Oracle 11
-- is better. (See Query 2, below.)
-- This example uses the scott.emp table.
-- Given a query that produces three rows for every department,
-- how can we show the same data in a query that has one row
-- per department, and three separate columns?
-- For example, the query below counts the number of employess
-- in each departent that have one of three given jobs:
PROMPT ========== 0. Simple COUNT ... GROUP BY ==========
SELECT deptno
, job
, COUNT (*) AS cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno
, job;
Output:
DEPTNO JOB CNT
20 CLERK 2
20 MANAGER 1
30 CLERK 1
30 MANAGER 1
10 CLERK 1
10 MANAGER 1
20 ANALYST 2
PROMPT ========== 1. Pivot ==========
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager_cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno;
-- Output:
DEPTNO ANALYST_CNT CLERK_CNT MANAGER_CNT
30 0 1 1
20 2 2 1
10 0 1 1
-- Explanation
(1) Decide what you want the output to look like.
(E.g. "I want a row for each department,
and columns for deptno, analyst_cnt, clerk_cnt and manager_cnt)
(2) Get a result set where every row identifies which row
and which column of the output will be affected.
In the example above, deptno identifies the row, and
job identifies the column.
Both deptno and job happened to be in the original table.
That is not always the case; sometimes you have to
compute new columns based on the original data.
(3) Use aggregate functions and CASE (or DECODE) to produce
the pivoted columns.
The CASE statement will pick
only the rows of raw data that belong in the column.
If each cell in the output corresponds to (at most)
one row of input, then you can use MIN or MAX as the
aggregate function.
If many rows of input can be reflected in a single cell
of output, then use SUM, COUNT, AVG, STRAGG, or some other
aggregate function.
GROUP BY the column that identifies rows.
PROMPT ========== 2. Oracle 11 PIVOT ==========
WITH e AS
( -- Begin sub-query e to SELECT columns for PIVOT
SELECT deptno
, job
FROM scott.emp
) -- End sub-query e to SELECT columns for PIVOT
SELECT *
FROM e
PIVOT ( COUNT (*)
FOR job IN ( 'ANALYST' AS analyst
, 'CLERK' AS clerk
, 'MANAGER' AS manager
NOTES ON ORACLE 11 PIVOT:
(1) You must use a sub-query to select the raw columns.
An in-line view (not shown) is an example of a sub-query.
(2) GROUP BY is implied for all columns not in the PIVOT clause.
(3) Column aliases are optional.
If "AS analyst" is omitted above, the column will be called 'ANALYST' (single-quotes included).
{code}
The second script, below, shows one way of doing a dynamic pivot in SQL*Plus:
{code}
How to Pivot a Table with a Dynamic Number of Columns
This works in any version of Oracle
The "SELECT ... PIVOT" feature introduced in Oracle 11
is much better for producing XML output.
Say you want to make a cross-tab output of
the scott.emp table.
Each row will represent a department.
There will be a separate column for each job.
Each cell will contain the number of employees in
a specific department having a specific job.
The exact same solution must work with any number
of departments and columns.
(Within reason: there's no guarantee this will work if you
want 2000 columns.)
Case 0 "Basic Pivot" shows how you might hard-code three
job types, which is exactly what you DON'T want to do.
Case 1 "Dynamic Pivot" shows how get the right results
dynamically, using SQL*Plus.
(This can be easily adapted to PL/SQL or other tools.)
PROMPT ========== 0. Basic Pivot ==========
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager_cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno
ORDER BY deptno
PROMPT ========== 1. Dynamic Pivot ==========
-- ***** Start of dynamic_pivot.sql *****
-- Suppress SQL*Plus features that interfere with raw output
SET FEEDBACK OFF
SET PAGESIZE 0
SPOOL p:\sql\cookbook\dynamic_pivot_subscript.sql
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;
SPOOL OFF
-- Restore SQL*Plus features suppressed earlier
SET FEEDBACK ON
SET PAGESIZE 50
SPOOL p:\sql\cookbook\dynamic_pivot.lst
SELECT deptno
@@dynamic_pivot_subscript
FROM scott.emp
GROUP BY deptno
ORDER BY deptno
SPOOL OFF
-- ***** End of dynamic_pivot.sql *****
EXPLANATION:
The basic pivot assumes you know the number of distinct jobs,
and the name of each one. If you do, then writing a pivot query
is simply a matter of writing the correct number of ", COUNT ... AS ..."\
lines, with the name entered in two places on each one. That is easily
done by a preliminary query, which uses SPOOL to write a sub-script
(called dynamic_pivot_subscript.sql in this example).
The main script invokes this sub-script at the proper point.
In practice, .SQL scripts usually contain one or more complete
statements, but there's nothing that says they have to.
This one contains just a fragment from the middle of a SELECT statement.
Before creating the sub-script, turn off SQL*Plus features that are
designed to help humans read the output (such as headings and
feedback messages like "7 rows selected.", since we do not want these
to appear in the sub-script.
Turn these features on again before running the main query.
{code} -
Hi Oracle Experts,
I have a challenging question . Lets say I have two table with same name, but these two tables comes from two different databases with 2 different users.
Source Database A and User SCOTT
Table
Column
Data_Type
Length
Precision
Scale
Primary Key
Nullable
Default
Comment
BOOKS
BOOK_ID
Varchar2
4
1
ISBN_10
Varchar2
13
yes
PRICE
Number
6
2
yes
Target Database B and User DAVID
Table
Column
Data_Type
Length
Precision
Scale
Primary Key
Nullable
Default
Comment
BOOKS
BOOK_ID
Varchar2
20
1
PRICE
Number
6
2
yes
TITLE
Varchar2
50
yes
What I want to do:
I want to get a query script that shows which columns need to modify, add and drop depends on source table (Make any necessary changes to make Target table columns same as Source table columns) . No need to do any changes in the database only want to see the query that needs to run for making these changes.
EXAMPLE: I was using below query to get EMP table creation query. But seeing column information to create same column for other user is hard:(
select dbms_metadata.get_ddl ('TABLE', 'EMP') from dualTools > Database DIFF
Use the object selector to only compare BOOKS
You'll get an ALTER Script as part of the results.
Maybe you are looking for
-
ADF 10g - Does ADF 10g / 11g support distributed / heterogeneous queries?
Is there an easy way to have a distributed / heterogeneous query in ADF? We would like to query two data sources and perhaps introduce a view link between two data sources (Oracle / Sybase AND Oracle / Oracle). Is this possible in ADF? I know we can
-
Scanned Documents = 0 bytes (OfficeJet Pro 8500 A909g)
So, I was pretty thrilled to successfully set up my network folder. That excitement quickly faded. Every time I scan something, it comes through as 0 bytes. Color PDF, B/W PDF, TIFF, JPEG, all the same result. This is with the multi document scann
-
I had Creative Suite 6 Design and Web Premium Win ESD on my computer, I had to have my computer reset to like a new computer, how do I reinstall CS6 back on my computer? Thanks, Mel
-
Is there a free way to run Windows Programs on a MacBook Pro?
Hi I am getting my first MacBook Pro tomorrow, and i am just curious as to how i could run Windows only software on it. It will only be a couple of games and music software, but i dont have the OSX version, and i dont really want to buy a new version
-
Wireless printer won't print my document because it another computer is using the printer
Canon MG5520 wireless printer will not print - message another computer is using the printer. No other computer is using the printer. I do have an IPAD and I did use it to print and it printed. It seems since I printed from the IPAD I am unable to pr