Creating Tables From a Master Table?
Hi all,
I am trying to create tables that are generated from a master table. The reason behind this is I want to easily be able to modify this master table and then be able to print a well laid out invoice without all the extraneous information. I'm not really explaining this well so here is an example.
My Master Table is on it's own sheet and has a categorized listing of products like so:
Fruit
Bananas, 5 units, $1.00
Apples, 3 units, $0.50
Peaches, 0 units, $2.00
Grains
Bread, 0 units, $1.00
Oatmeal, 0 units, $2.00
Vegetables
Lettuce, 4 units, $2.00
Celery, 6 units, $1.50
Carrots, 2 units, $3.50
On a seperate invoice sheet I would have multiple tables laid out to print. It will have a summary table like this:
Summary
Fruit, Subtotal $6.50
Vegetables, Subtotal $24.00
Total $30.50
and seperate tables for each category:
Fruit
Bananas, 5 units, $1.00
Apples, 3 units, $0.50
Subtotal $6.50
Vegetables
Lettuce, 4 units, $2.00
Celery, 6 units, $1.50
Carrots, 2 units, $3.50
Subtotal $24.00
Notice it does not include the peaches or grains since I didn't actually sell any units of those.
Is this possible? Can anyone point me in the right direction? Thanks.
Most of this looks possible. The most obvious exception is not showing the separate table for grains when no grains are shown.
A table has a defined number of rows and columns. That number may be changed manually, but I know no way of either adding or removing rows (or columns) through the use of formulas. If you want to use separate tables for each of these, you will need to set up four separate tables, each with the number of columns needed and, assuming there is a possibility that any particular order may include all items in at least one category, each with as many rows as there are items in the category for that table.
If you are willing to forego separate tables on the Invoice, then an outcome similar to what you ask is likely possible.
In your example, you have listed the subtotals for each category in which there has been an order at the top of the page, then have repeated those subtotals in a second line in each separate table. Why?
Regards,
Barry
Similar Messages
-
How to create a table from an existing table with new column
Hi !
Please help me.
I want to create a table from an existing table with data and add two new column to the new table.
What will be the syntax?craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
if you want to have VARCHAR2 instead of CHAR for example:
SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
Table created.
SQL> desc new_dept
Name Null? Type
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
NEW_COL CHAR(8)
SQL> alter table new_dept modify (new_col varchar2(8));
Table altered.
SQL> desc new_dept
Name Null? Type
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
NEW_COL VARCHAR2(8)Rgds.
Didn't see michael's post - it reflects the fix for this problem using CAST.
Message was edited by:
dnikiforov -
How do I pull information from a master table to another table?
This may be quite simple, but I'm missing something. I want to pull information from my master table into a secondary table. In the Master Table in Column A, I have a list of teams ("Team 1" through "Team 12"), then in Columns B through D I have information for each assignment given to each team. I want to have a secondary table for each team that lists all of their assignments. So, this is what I want: if Column A says 'Team 1', then I want the secondary table to have the info from Columns B through D.
Again, I'm sure it's simple, but I just can't figure it out.
Thanks for any help.
MarkHi Mark,
1) But does this work if in the Master Table (which will be over 300 rows long) each team will show up 10-15 times over the course of the 300 rows randomly (hence the need to have sub-tables for each team...so it's easier for them to see what their tasks are).
Your fellow Numbers enthusiasts in this forum will need more information to help you with that. You are on the right track though with the idea of many tables. Therein lies the power of Numbers.
2) I'm a bit confused by the formula. With the "$A2" do I select the first column in the Master Table? And can you break down the second part of the formula? The "$A$2:$D$4,2,0" Why would you have A2 and D4 in the same formula? They are not in the same row. And what's the 2,0 at the end?
Breaking this question down:
With the "$A2" do I select the first column in the Master Table?
No. The $ keeps the reference to Column A absolute (it won't change to B then C as you Fill Right in the Team Task Table.
And can you break down the second part of the formula? The "$A$2:$D$4,2,0" Why would you have A2 and D4 in the same formula? They are not in the same row.
$A$2:$D$4 is the range of cells (a rectangle) where VLOOKUP will search (in my example) but not in your 300 row table!
And what's the 2,0 at the end?
The syntax of VLOOKUP is VLOOKUP(search-for, columns-range, return-column, close-match)
The 2,0 at the end means "return column" is 2 (the second column of the range) and 0 means "Exact Match" - it won't find a close match. After Fill Right you will need to edit the formula in each Column to change "return column" to 3, then 4, then ...
With a table selected, click on the Function Button in the Toolbar and choose Function Browser. I find that much more useful than the Help Menu. However (there is always a however in life) the Help Menu will show Numbers User Guide, and Formulas and Functions Help. Download them and read at your leisure. The first four chapters of the User Guide are well worth a read. Use other chapters as a reference when you need them.
Regards,
Ian. -
Create one tables from 2 different tables
Hi,
How I can create one table from 2 different tables. Source tables have data and I want to include it in new table.
I try this:
create table NEW_ONE
select * from OLD_ONE
union
select * from OLD_ONE2;
But it didn't work correctly :/I don't have any error. This syntax create table NEW_ONE, but this table have columns only from OLD_ONE table :/ There aren't any column from OLD_ONE2 :/ Any suggestions?
I don't forget about "as" in my query, only in this post.
Edited by: tutus on Sep 8, 2008 6:36 AM -
How to identify all the child tables referencing a master table
Hi,
How to identify all the child tables referencing a master table.
Could you please help me...
Thanks in advance...Hi!
You may use this query:
SELECT master.table_name, child.table_name
FROM user_constraints master, user_constraints child
WHERE master.table_name IN ('REGIONS')
AND master.constraint_name = child.r_constraint_name
/yours sincerely
Florian W. -
Can we run an assignment on a qualified table from a main table?
Can I run an assignment on a qualified table from a main table.
For example: My main table Vendor and Qualified Table is Company Qualified .
Company Qualified - VendorNr (Non- Qualifier),Company(Qualifier,lookupFlat - Company)
Company - Name,Description (It has valid values in it already).
How to add a default value into the Company Qualified table.
When i add a assignment like
If(is_null(Company Qualified [Record],default lookup value from Company) ...it says invalid.
Any help greatly appreciated thanksThis is not possible currently in MDM. I've tried many times to find a good way to do this and so far have been unsuccessful. I also have tried to have a workflow on the main table call an assignment in a lookup / qualified table, and that doesn't work either. The biggest reason is because you have to select a table field when you create an assignment, and it doesn't give you the option to choose fields within a table.
Hopefully they will address this in a future release.
Edited by: Harrison Holland on Jun 3, 2008 2:33 PM -
This entry already exists in following tables "tax formula master table'
I am getting this error while adding a new tax Formula.
Please suggest the possible solution.
SAP B1 2007 B PL-10
This entry already exists in following tables "tax formula master table' (OFML) (ODBC-2035) [Message134-183]
Regards,
RanjithHi
First of all have u tried what i told ??
For which tax going u r going to create???
Check in another DB, whether same error is coming r not
Giri
Edited by: Giri dharan on Dec 30, 2009 5:47 PM -
Lgical table from two physical table
Hi,
I am trying to design a logical fact table from two physical table. One table has transaction data and another has accounting data. The requirement is, I need to merge the rows between these two tables, where were it matches. If the keys are not matching between these two table then also I need to bring those rows from both tables as separate rows. How can i do this? Also can i have a logical table as source for my fact table.You'll need outer joins in your physical layer and you can drag the columns from both physical tables to a single logical table and you will see in the BMM layer it will create the two logical table sources.
-
Hi, Bapi or function module to update RBCO table from an internal table.
I have a requirement to update RBCO table from an internal table. is there any Bapi or function module or any other method other than update, modify statements.
Moderator message: Welcome to SCN!
Moderator message: please do more research before asking, show what you have done yourself when asking.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jul 12, 2011 12:28 PMI don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.
-
Insert data into fact table from source database tables
here i try to insert data into fact table from source database tables here is the query
ALTER procedure [dbo].[facttable]
as
insert into [pp dw].dbo.Dimfact(Prod_ID,Production_ID,Material_ID,Equip_ID,WC_ID,Recipe_ID,Quantity,costprice)
select Products.[Product ID],[Production ID],Materials.[Material ID],[Equipment ID],[Work Centre ID],[Recipy ID],Quantity,[cost price]
from
[PRODUCTION PLANNING 2].dbo.[Products],
[PRODUCTION PLANNING 2].dbo.[Production Detail],
[PRODUCTION PLANNING 2].dbo.[Material category],
[PRODUCTION PLANNING 2].dbo.[Materials],
[PRODUCTION PLANNING 2].dbo.[Equipment],
[PRODUCTION PLANNING 2].dbo.[Working Centre] ,
[PRODUCTION PLANNING 2].dbo.[Recipies]
where
Products.[Product ID] in (13, 14, 15, 16, 17) and
[Production Detail].[Production ID] in (1, 2, 3) and
[Materials].[Material ID] in (1, 2, 3, 4, 5) and
[Equipment].[Equipment ID] in (1, 2, 3, 4) and
[Working Centre].[Work Centre ID] in (1, 2, 3) and
[Recipies].[Recipy ID] in (1, 2, 3) and
[Material category].[Category ID] in (8, 9, 10, 11, 12, 13)
and when i execute query it shows me error
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dimfact_Dimproduct". The conflict occurred in database "pp dw", table "dbo.Dimproduct", column 'Prod_ID'.
ERD IS
HOW TO SOLVE THIS PROBLEM?I cant see any join conditions in your query posted. Whats the purpose of the query above. It will just bring you a cartesian product (cross join) of tables involved subjected to filters. Are you sure this is the correct query?
The error you're getting may be because you've not yet populated DimProduct or may be because of logic you used in popultaing DimProduct causing it to miss some records which is what query is referring to in above case.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Query --- to find all child tables for a master table
Suppose i have a table master .
I want to know all tables which are child tables for this master table .
In other words i want to know all those table names which have foreign key constraint for the master table .
regards
shubhaYou may want to join on the owner in case you have multiple schemas with same table names and same primary key names
SELECT c.table_nameFROM all_constraints c, all_constraints p
WHERE c.constraint_type = 'R'
AND c.r_constraint_name = p.constraint_name
AND p.constraint_type = 'P'
AND c.owner = p.owner
AND p.table_name = '&YOUR_MASTER_TABLE' -
PLS-00327 when updating table from a remote table inside a PLSQL procedure
Hi,
Inside a PL/SQL procedure,I want to update a table from a remote table :
begin
UPDATE rachel1 set NEW_TEN_CODE =
(SELECT NEW_TEN_CODE FROM rachel@REFI
WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
end;
I receive the error :
PLS-00327: "RACHEL" is not in SQL scope here
When I extract the update from the procedure and I run from SQL (without begin ... end), it works :
SQL> UPDATE rachel1 set NEW_TEN_CODE =
2 (SELECT NEW_TEN_CODE FROM rachel@REFI
3 WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
So, why doesn't the update work inside the PL/SQL procedure ?
What have I to do ?
I need to run this command inside the procedure.
Regards,
RachelHi,
Yes, the owner of the procedure have select on RACHEL@REFI.
My oracle version is : 8.1.7.4.
In fact, I've resolved the problem by doing :
begin
UPDATE rachel1 set NEW_TEN_CODE =
(SELECT NEW_TEN_CODE FROM rachel@REFI
WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE);
end;
Regards,
Rachel -
Updating database table from an internal table
Hi All,
I am updating a database table from an internal table.
I am changing the non-key fields in that table.
when I check sy-subrc = 4.
Record already exists, because I am changing non-key fields of the
database table.
Is there any addition like to accept the duplicate keys with update.
Alternatively, I have used Modify, It is adding new record,
Again, I have search the old record and use Delete on the database table.
Thanks & Regards,
Kalyan Chandramouli
SAP ABAP ConsultantHi,
You are right, the field which I am trying to change is a part of primary key.
Because, sy-subrc = 4. says,
No line with specified primary key exits in the database table.
I have a Z-tabel, with Kunnr Vkorg Matnr Bzirk Bztxt Split_percentage
In this table primary key consists of KunnrVkorgMatnr+Bzirk.
I am able to change the Split_percentage using UPDATE.
Now, my client want to change Bzirk, Bztxt also in the table.
How can I Go.
Thanks & Regards,
Kalyan Chandramouli
SAP ABAP Consultant -
NEED HELP ASAP-populate contents from 5 tables into one master table
Scenario:
Assign a new_customer_id to each existing customer of our three business. A master lookup table (M) was given to me with pre-populated (SEQ_NOs), (NEW_CUSTIDs), and NULL in (OLD_CUSTIDS). My duty is to
(1) Fill the M.OLD_CUSTID column with existing customer ids from T1, T2, T3 (uniquely).
(2) Once the master lookup table is filled, add (SEQ_NO), and (NEW_CUSTID) column to the 3 existing customer tables to hold the new information.
(3) At the end of the project, remove the existing customer ids from the T1, T2, T3.
My problem is that there are no associations between the master table and existing customer tables (no keys). The code would be:
update M
set OLD_CUSTID= (select OLD_CUSTID from T1 where M.??=T1.??)
Since the M.OLD_CUSTID and T1.NEW_CUSTID are NULL at this stage, and there are no keys to tie them together. I don't know how to fill both tables. Can someone help me ASAP? Thanks in Advance.
-ORACLE NewbiI am building a "MASTER LOOKUP TABLE" to map the NEW_CUSTID and the OLD_CUSTID. The columns in this M table are:
CREATE TABLE MKT.M
"LOOKUP_SEQ" INTEGER, <=== from sequence
"NEW_CUSTID" CHAR(6), <=== populated with strings given by biz analyst
"OLD_CUSTID" INTEGER, <=== need to dump all existing custid (unique)
PRIMARY KEY ("NEW_CUSTID") RELY NOVALIDATE
ORGANIZATION INDEX TABLESPACE "MKT"
Table T1/T2/T3 are slightly different but they all contain:
CUST_ID INTEGER
CUST_NAME CHAR(50)
CUST_SINCE DATE
CUST_ADDR1 CHAR(30)
CUST_ADDR2 CHAR(30)
DITY CHAR(30)
STATE CHAR(2), etc.
Since M is the lookup table for old-to-new customer ID mapping. There are no need to associat other than just enter the old IDs into the M table.
Thanks for helping me. Any suggestion? -
Count distinct from a master table and sum from a detail
Hello to all,
I have a query like as:
select a,b,c, SUM(fa.ip1) S1, SUM(fa.ip2) S2
FROM tab1 FI, tab2 FA
where fi.x1 = fa.x1
and fi.x2 = fa.x2
group by a,b,c;
tab1's table is master table for tab2's table (one tab1 records there are many tab2 records), (one to many relation)
My question is, how can I get to sum of columns: ip1 and ip2 from tab2 Fa, with only count(how many) of rows of tab1?
Somethings similar to;
Select a,b,c, count(distinct fi.x1, fi.x2 ) nrec_of_FI, SUM(fa.ip1)S1, SUM(fa.ip2) S2
Thanks in advanceHi,
Sorry, I can't tell what you want just by looking at code that does not do it.
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
Perhaps you want to get the totals in 2 stages, like this:
WITH five_column_totals AS
select a, b, c
, fi.x1, fi.x2 -- For debugging only
, SUM (fa.ip1) AS prelim_S1
, SUM (fa.ip2) AS prelim_S2
FROM tab1 FI
, tab2 FA
where fi.x1 = fa.x1
and fi.x2 = fa.x2
group by a, b, c
, f1.x1, f2.x2
SELECT a, b, c
, COUNT (*) AS nrec_of_f1
, SUM (prelim_s1) AS s1
, SUM (prelim_s2) AS s2
FROM five_column_totals
GROUP BY a, b, c
Notice that the sub-query called five_column_totals is essentially what you posted, except that there fi.x1 and fi.x2 are included in the GROUP BY clause. That means the sub-query will hve a separate row for each distinct combination of x1 and x2, which you can COUNT in the main query, GROUPing only BY a, b and c.
Maybe you are looking for
-
Creative cloud taking so long to download
Creative Cloud desktop is taking so long to download. The progress bar has not moved more than a centimeter in over an hour. And why can't I speak with a live person about this??
-
IPhoto 08 rebuild of all thumbnails fails with KERN_PROTECTION_FAILURE (0x0
I've used the option-cmd iPhoto launch to rebuild the database. This has cleared up a number of problems (Thanks, Terence and others!). Now I've finally got everything organized the way I want it (I think), so I took a backup and started the rebuild
-
Display Problem : URGENT!
All 8 iMac's screens have gone black at my father's office, he expects me to figure something out to fix them in the next 4 hours. But i need some help. What is the key command to shut down an iMac G4 running 10.4? And yes i know its not an Intel bas
-
I am using Aperture 3. I wonder where I can see focus mode for my photos? I am a beginner learning to use manual focus. I compare the result between MF and AF a lot. A piece of information of focus mode shown in inspector would be very helpful to me.
-
Very distorted colors in LR (1.3.1)
Does anybody have an idea what happened here? Suddenly, all my pictures in LR look like this now... JPG image: http://img88.imageshack.us/img88/3296/ligthroomproblemut9.png Raw image: http://img235.imageshack.us/img235/4673/lightroomproblemrawhc3.png