The ANSI syntax for the join 4 tables-is this correct?
Hi, I'm new to these forums and I have looked everywhere and cannot find the syntax and examples on how to join the tables 2 and 3 using the ANSI standard, but I need to reach 4. For a traditional join, it would be:SELECT a.two b.one, b.three, b, a.one, d.seven
Tablea, tableb b, c in tablec, deposited d
WHERE a.one = b.one
AND a.two = c.two
AND c.six = d.six;
Here are the tables:
TableB
one
three
four
TableA
one
two
TableC
two
six
deposited
six
seven
eight
Anyone know how to do this by using an ANSI join or have all of the resources that can guide me in the right direction. I don't know if I wanted to join three tables, it would be:
SELECT a.two b.one, b.three, b, a.one, c.six
FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = c.two;
so join a fourth would:
SELECT a.two b.one, b.three, b, a.one, d.seven
FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = d JOIN filed c.two ON c.six = d.six;?
Is the above correct or is there another way to do this, use an ANSI join?
Published by: user1076466 on October 17, 2009 17:40
Hello
your JOIN looks good,
"FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = d JOIN filed c.two ON c.six = d.six" you get a different result set?
Thank you
Tags: Database
Similar Questions
-
I'm having the problem of local connection on my Dell PC with Vista. ISP is Verizon FIOS. FiOS representative told me to disable Ipv6 and the problem stops. Is this correct?
original title: local area connection problemHello
1. What is the exact problem you are facing with local connection?
2. how many computers have you plugged into the network?
Please provide the information of network event logs to help you best.
Click on the link below.
In the meantime, run the troubleshooter mentioned in the link below.
http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-network-connection-problems
-
Tuning for sql join key table no consumer of the heavy use of the query processor
Obligation comes to tunne prod of the query in
high use of the query processor
sql_id: fp79wb32h7a6t
Module: AHC, P_PatientDQ()
Cost: 7
Elapsed time: hung
Status: Hung, 35,253,460 day at 30 minute intervals
-Create table
create table ahc. PATIENTVISITS
(
ahcid NUMBER,
visitId NUMBER,
visitstatus NVARCHAR2 (100),
visitdate DATE,
visitintime DATE,
visitouttime DATE
)
-Create/recreate the index
create indexes ahc. F1_PATIENTVISIT_AHCID on ahc. PATIENTVISITS (AHCID, VISITID);
create indexes ahc. VISITDATE_IDX on ahc. PATIENTVISITS (TRUNC (VISITDATE));
First total number of table
Select count (1) of
Pvs AHC.patientvisits
-Save County 1387485
create table ahc. PATIENTDEPENDENTVISITS
(
ahcid NUMBER (19) not null,
IDPack NUMBER (10) not null,
visitId NUMBER (19) not null,
dependentvisitid NUMBER (19) not null,
isdiabetic NUMBER (2)
)
-Create/recreate the index
create indexes ahc. K1_PATIENTDEPENDENT_AHCID on ahc. PATIENTDEPENDENTVISITS (AHCID);
Total number of second table
Select count (1) of
AHC.patientdependentvisits POS
-Save County 774599
Original request:
SELECT count (*)
ACH. PVS PATIENTVISITS
WHERE PVS. VISITID IN (SELECT POS. DEPENDENTVISITID
ACH. PATIENTDEPENDENTVISITS POS
WHERE POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0)
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
AND PVS. AHCID = 37
Count (1)
-----------
1
PL/sql Developer explain plan for the original query
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, GOAL = ALL_ROWS 7 1 41 63669 7 AGGREGATION OF TRI 1 41 SEMI OF THE NESTED LOOPS 7 1 41 63669 7 TABLE ACCESS BY INDEX ROWID AHC PATIENTVISITS 4 1 25 33295 4 INDEX RANGE SCAN AHC F1_PATIENTVISIT_AHCID 3 9 23164 3 TABLE ACCESS BY INDEX ROWID AHC PATIENTDEPENDENTVISITS 3 1 16 30375 3 INDEX RANGE SCAN AHC K1_PATIENTDEPENDENT_AHCID 2 14 18093 2 After editing the query
SELECT / * + FIRST_ROWS * / COUNT (1)
ACH. PVS PATIENTVISITS
JOIN THE AHC. PATIENTDEPENDENTVISITS POS ON PVS. VISITID = POS. DEPENDENTVISITID
WHERE PVS. AHCID = POS. AHCID
AND POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
Count (1)
-----------
1
PL/sql Developer explain plan for change request
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, TARGET = TIP: FIRST_ROWS 7 1 41 59257 7 AGGREGATION OF TRI 1 41 NESTED LOOPS NESTED LOOPS 7 1 41 59257 7 TABLE ACCESS BY INDEX ROWID AHC PATIENTDEPENDENTVISITS 4 1 16 36646 4 INDEX RANGE SCAN AHC K1_PATIENTDEPENDENT_AHCID 3 14 24364 3 INDEX RANGE SCAN AHC F1_PATIENTVISIT_AHCID 2 1 15293 2 TABLE ACCESS BY INDEX ROWID AHC PATIENTVISITS 3 1 25 22611 3 here after I changed the query no display cost = 7 io wait = improvement also 7 can someone please help these
How to adjust or rewrite lots of join not keys to multiple records on table table
Thank you
VSM
you have not answered my question. Are you really calling it 35 million times in 30 minutes?
If so, why?
-
Since your last update that my Norton toolbar will not work... If it does not work, will not use your product. Can it be fixed quickly?
According to the article, I linked to before, you will need to update the norton version 2015.2.1.13 toolbar that is compatible.
-
Is it true that he didn't there had no Photoshop CC upgrade for more than 80 days? I have not received notice for more than 80 days.
You are currently at day then! It was released on 10-12-14, I think.
Benjamin
-
Columns in the dimension fact table
OBIEE, can we use a column of fact in the related dimension table where this column is only a description column? Well Yes, I know that use columns of fact indeed and volumetric size... But what exactly will question if we do? I have observed in one model... No data connection was there to test...
Hi Hari,
Why you cannot create two tables MDB is as a fact and DIM and place all the columns in the description of Sun and measures actually?
in this way, you should reach patterns star in MDB
http://www.varanasisaichand.com/2012/04/fact-and-dimension-from-single-source.html (2nd method)
Thank you
Angelique
-
Hi guys,.
I was hoping just to get your opinion on something.
I have a Production process that is taking longer and more time to complete, and sticks to a certain section of code.
The code is an INSERT in the main dimension table.
This procedure works well on the TEST and the code section end much more quickly.
Traffic on the Production is much heavier and there are applications developed by people other than me who SELECT this dimension table. I am assuming, based on the fact that the Test and Production code are identical, this increase in traffic could be eating upwards of bandwidth and slows down the jobs.
So I thought - if I create views and leave the other applications hit the opinions as opposed to the main table, this will help speed it up. I did it before on a Teradata platform using a "dirty read" that has worked very well, but Oracle does not offer this option.
What do you think guys? Impossible this work or do I have to take a different approach.
Thank you.You are welcome
-
Hello
Oracle version: 11.1.0.7.0 - 64 bit
I read the documentation online at joins. The page is avialable here: joins at
My question is about the join order of evaluation of the conditions in clause and the conditions of those
are not the join conditions and are placed in the WHERE clause.
Consider the following pseudocode
SELECT
T1. Col1,
T2.Col1
Of
Table1 t1 LEFT OUTER JOIN table2 t2
WE
(condition_expression1)
WHERE
(condition_expression2)
Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article?
Thanks in advance,
Hello
dariyoosh wrote:
Hello
Oracle version: 11.1.0.7.0 - 64 bit
I read the documentation online at joins. The page is avialable here: joins at
My question is about the join order of evaluation of the conditions in clause and the conditions of those
are not the join conditions and are placed in the WHERE clause.
Consider the following pseudocode
SELECT
T1. Col1,
T2.Col1
Of
Table1 t1 LEFT OUTER JOIN table2 t2
WE
(condition_expression1)
WHERE
(condition_expression2)
Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article? ...
The reverse is actually closer to the truth, but we can't really make general statements like that.
SQL is not a language of the proceedings. Looking at the code SQL, we could say that the code does, but we cannot say much about how that code it. In other words, SQL is a language that describes the results you get, not the way to get them.
The optimizer will do everything what he thinks is faster if it does not change the results. If any order in which they are applied (in outer joins or CONNECT BY queries, for example), then think of the join is done first, and the value of the WHERE clause is applied to the result of the join.
Here is a query looks very much like you posted:
SELECT d.deptno
e.ename, e.sal
OF scott.dept d
LEFT OUTER JOIN scott.emp e ON e.deptno = d.deptno
WHERE e.sal > = 3000
ORDER BY d.deptno
;
Output:
DEPTNO ENAME SAL
---------- ---------- ----------
10 KING 5000
20 FORD 3000
20 3000 SCOTT
The scott.dept table contains deptnos 30 and 40; Why are they not in the result set? The query behaves as if the outer join is made first (production 15 rows), then the WHERE clause has been applied. All lines with deptno = 30 had sals down han 3000 and all single line with deptno = 40 was NULL in the sal column, then these lines are excluded (as well as other lines of deptnos 10 and 20), and only 3 lines above are left.
-
How do I display values skyrocket in the IR filter for the joined table columns?
Hello
I have a problem in the IR the query is based on a table, joined with other tables. I would like to provide users the ability to use IR filter search bar in the joined table columns. The problem facing on this filter, the Expression field, by pressing the arrow button displays values for the fields in the primary table, but not for fields that come from joined tables. Have you experienced this behavior in your reports? Is this normal?
TIAHello
Correlated subqueries can improve performance - but it does not depend on the involved tables, the number of columns and the existence of indices. As far as I know, the optimizer has problems with them. You could try to explain the Plans on the two statements to verify that.
In any case, I created a new test page with the SQL for IR:
SELECT E.EMPNO, E.ENAME, D.DEPTNO, D.DNAME, E2.EMPNO "EMPNO2", E2.ENAME "ENAME2" FROM EMP E, EMP2 E2, DEPT D WHERE E.EMPNO = E2.EMPNO(+) AND E.DEPTNO = D.DEPTNO(+) AND E2.PRIMARY_EMPLOYEE(+) = 'Y'
http://Apex.Oracle.com/pls/OTN/f?p=267:226
As far as I can see, it works properly - except that if I do a filter on the ename column, when I try to create a second filter, drop-down lists ename all the values, while the other columns list only the available values after having applied the first filter. Which seems strange that the filters are applied as ANDS. But it does the same thing for other areas - IE, the field used in a filter is not filtered for the second filter - so I guess this is normal, but only a person in Apex could probably explain why it is so.
Otherwise, everything seems to work as I expect and the above page works the same as my test page, which uses external joins http://apex.oracle.com/pls/otn/f?p=267:224
Andy
-
How it warns Oracle to use an index for the join of two tables...
How to prevent the Oracle to use an index for the join of two tables to get a view online that is used in an update statement?
O.K. I think I should explain what I mean:
When you join two tables that have many entries sometimes there're better is not to use an index on the column that is used as a criterion to join.
I have two tables: table A and table B.
Table A has 4,000,000 entries and table B has 700,000 entries.
I have a join of two tables with a numeric column as join criteria.
There is an index on this column in A table.
So I instead of
I want to usewhere (A.col = B.col)
in order to avoid Oracle using the index.where (A.col+0 = B.col)
When I use the join in a select query, it works.
But when I use the join as inline in an update statement I get the error ORA-01779.
When I remove the '+ 0' the update statement works. (The column is unique in table B).
Any ideas why this happens?
Thank you very much in advance for any help.
Hartmut cordiallyYou plan to use a NO_INDEX hint as shown here: http://www.psoug.org/reference/hints.html
-
JOIN the question... Join two tables without omitting lines
I came across a problem that should be an easy fix (I hope), but I'm having a hard time to come up with a solution.
Basically I have two tables, one with the actual amounts with the budget. I have to write a sql statement select that joins these tables together and includes all of their lines. I was able to join the tables by using JOIN, LEFT JOIN and RIGHT JOIN, but it always fails the lines I need.
Below, I have examples of my tables (AMOUNT_TABLE and BUDGET_TABLE). For simplicity, I built the examples to show the same values in the first four columns, with the 5th and 6th columns (SUB_ACCOUNT, AMOUNT, BUDGET) as the only values that are different. My actual tables are not quite that simple, but I don't think it was relavent to this issue.
AMOUNT_TABLE
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT 2013
1 11111 555555 0000 100 2013 1 11111 555555 1000 100 2013 1 11111 555555 2000 100 2013 1 11111 555555 3000 100 2013 1 11111 555555 4000 100 BUDGET_TABLE
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT BUDGET 2013
1 11111 555555 3000 200 2013 1 11111 555555 4000 200 2013 1 11111 555555 5000 200 2013 1 11111 555555 6000 200 Here's what I hope. Note that SUB_ACCOUNTs 0000, 1000, and 2000 show without budget amounts since there is not a corresponding line in the BUDGET_TABLE. And same for SUB_ACCOUNTs 5000 and 6000, they show budgets with no amount because there is not a corresponding line in the AMOUNT_TABLE.
(exit)
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET 2013 1 11111 555555 0000 100 0 2013 1 11111 555555 1000 100 0 2013 1 11111 555555 2000 100 0 2013 1 11111 555555 3000 100 200 2013 1 11111 555555 4000 100 200 2013 1 11111 555555 5000 0 200 2013 1 11111 555555 6000 0 200 If all goes well, my question is clear. Any help on this would be greatly appreciated. Thanks in advance.
Use the join ANSI - FULL OUTER JOIN syntax:
with amount_table like)
Select fiscal_year 2013, 1 period, 11111 acct_unit, 555555, 0000 sub_account, amount 100 of all the double union
Select 2013,1,11111,555555,1000,100 from all the double union
Select 2013,1,11111,555555,2000,100 from all the double union
Select 2013,1,11111,555555,3000,100 from all the double union
Select double 2013,1,11111,555555,4000,100
),
budget_table like)
Select 1 time, 11111 acct_unit, account 555555, sub_account 3000, 2013 fiscal_year, budget of 200 Union double all the
Select 2013,1,11111,555555,4000,200 from all the double union
Select 2013,1,11111,555555,5000,200 from all the double union
Select double 2013,1,11111,555555,6000,200
)
Select nvl (a.fiscal_year, b.fiscal_year) fiscal_year,
period of NVL (a.period, b.period),
NVL (a.acct_unit, b.acct_unit) acct_unit.
account of NVL (a.Account, b.Account),
NVL (a.sub_account, b.sub_account) sub_account.
Amount NVL(a.amount,0),
NVL(b.budget,0) budget
of amount_table one
full join
budget_table b
on)
a.Fiscal_Year = b.fiscal_year
and
a.period = b.period
and
a.acct_unit = b.acct_unit
and
a.Account = b.account
and
a.sub_account = b.sub_account
)
/
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET
----------- ---------- ---------- ---------- ----------- ---------- ----------
2013 1 11111 555555 0 100 0
2013 1 11111 555555 1000 100 0
2013 1 11111 555555 2000 100 0
2013 1 11111 555555 3000 100 200
2013 1 11111 555555 4000 100 200
2013 1 11111 555555 6000 0 200
2013 1 11111 555555 5000 0 2007 selected lines.
SQL >
SY.
-
How to join two tables if you transpose the rows, columns and rows in one of the table
Hi guys,.
can someone help me please in the write request
I have two tables
Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)
So instead of display 4 rows, I used max(case...) to convert rows to columns
now how to reach it with another table
Requirement:
Database: 11.2.0.2.0
create the table AGENT_PHONE
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
Phone_Number VARCHAR2 (16) not null,
phone_type_code VARCHAR2 (10) not null
)
CREATE TABLEAGENTS
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
NAME VARCHAR2 (40) NOT NULL
)
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');
INSERT INTO VALUES AGENTS
(29709, ARE ', 'OFFICE', 'FLY');
INSERT INTO VALUES AGENTS
(1234, ARE ', 'OFFICE', 'MIKE');
SELECT * FROM AGENT_PHONES
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE ---------------------------------------------------------------------------------------------
29709 RE OFFICE 4805551436 CELL 29709 RE OFFICE 1111111111 PHONE 29709 RE OFFICE 2223334444 OFF 29709 RE OFFICE 5556667788 FAX
SELECT * AGENTS
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME
29709 RE OFFICE ROB 1234 RE OFFICE MIKE
This is so the data we have in both table
Now, I transposed rows to columns in the table of agent phones so I used the following query
SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.
MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE
AGENT_PHONE AP
WHERE AP. AGENT_ID = 29709
GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL OFF FAX PHONE 1 29709 RE OFFICE 4805551436 2223334444 5556667788 1111111111 My question is how this to join the agents table so that my output should be like this...
I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE Currently, I run this query and I get the output as below
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE 1 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 CELL 2 29709 RE OFFICE ROB 29709 RE OFFICE 1111111111 PHONE 3 29709 RE OFFICE ROB 29709 RE OFFICE 2223334444 OFF 4 29709 RE OFFICE ROB 29709 RE OFFICE 5556667788 FAX 5 1234 RE OFFICE MIKE I want id 29709 agent in a line with 1234 agent also id to display
You can rotate your phone number of agent in columns
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 Then you can join to view inline or CTE
with AGENT_PHONE_PIVOT like)
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
)
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE_PIVOT AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE - - - - - - - Is that what you're looking for?
-
Hello
I want to join the two tables to retrieve the data from the columns of the two table passing parameters to the join query. Tables have primary and foreign key relationships
Details of the table
Alert-1 - AlertCode (FK), AlerID (PK)
2 AlertCode-AlertDefinition-(PK)
Help, please
----------
Hi Vincent,.
I think that you have not worked on adf 12.1.3. In adf 12.1.3 you don't have to explicitly create the association. When you create the EO to your table, Association xxxxFkAssoc, will be created by ADF12.1.3 for you automatically. Please try this and do not answer anything... You can also follow the links below. I solved the problem by using the following link
---
-
Help with a script to search for text in a table cell and apply the cell style
Hello
I build the script which Jongware wrote in his post here http://indesignsecrets.com/tackling-tables-through-scripting.php - I am trying to create a variable in which I can add a number of different parts of the text, in this case it's different parts of the United Kingdom i.e. 'London', 'East', 'Scotland' etc. I just need the script to apply the cell Style - 'District Cell' - to any cell that contains text in the variable. Here's the script, if anyone can help I would be grateful.
function checkWhichTable() { // ensure the user made a selection if (app.selection.length != 1) return null; var currentTable = app.selection[0]; if (currentTable.hasOwnProperty("baseline")) { currentTable = app.selection[0].parent; } while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column) currentTable = currentTable.parent; if (!(currentTable instanceof Table)) { // No table selected return null; } return currentTable; } app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table"); function checkUserSelection () { var a_table = checkWhichTable(); if (a_table == null) { if (confirm("No table selected. Do you want to process *all* tables?") == false) return; allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements(); for (aTable=0; aTable<allTables.length; aTable++) { processTable (allTables[aTable]); } } else { processTable (a_table); } } function processTable(table) { // do something here! //Find Text in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West']; for (i=0; i<table.cells.length; i++) { if (table.cells[i].texts[0].contents==textInCell) table.cells[i].appliedCellStyle = "District Cell"; } }
Hello
Change this feature:
function processTable(table) { //Find Text (exactly as it is) in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West'], mFound, cFound; app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "^(" + cities.join("|") + ")$"; mFound = table.findGrep(); while( cFound = mFound.pop() ) cFound.parent.appliedCellStyle = "District Cell"; }
Jarek
-
Need to know the grain of the join table
Hi Experts,
I have a doubt,
Let say I take data from two tables
pay_costs
PAY_COST_ALLOCATIONS_F
for tables, the columns are
pay_costs. BALANCE_OR_COSTS
pay_costs. DEBIT_OR_CREDIT
PAY_COST_ALLOCATIONS_F.PROPORTION
Now, I need to join these two tables respectively. I followed site etrm and found that we can create the join
PAY_COST_ALLOCATIONS_F.PAY_COST_ALLOCATION_KEYFLEX = PAY_COST_ALLOCATION_KEYFLEX. PAY_COST_ALLOCATION_KEYFLEX
and PAY_COST_ALLOCATION_KEYFLEX. COST_ALLOCATION_KEYFLEX_ID = pay_costs. COST_ALLOCATION_KEYFLEX_ID
so I'm doing something wrong. The grain of the data is going to change... Help kindly I am new to the field of ebsHello
You will potentially have millions of records in PAY_COSTS because it's the main compensation table.Your PAY_COST_ALLOCATIONS_F contains only a breakdown of how the costs of a user should be broken out. There is an ASSIGNMENT_ID (which connects to the person) and a PROPORTION corresponding to the percentage.
Depending on how long the person has been with the company, for each assignment ID (that you can consider PERSON_ID), there might be hundreds of files in PAY_COSTS.
The primary key of the PAY_COSTS is the COST_ID while the primary key of the PAY_COST_ALLOCATIONS_F is COST_ALLOCATION_ID more EFFECTIVE BEGIN and EFFECTIVE END dates. Which tells me, is that the benefits are time and if you try and join the ALLOCATION_ID you will end up with a wrong answer. If you were within the E-Business Suite, application effective date using the current date as the default value. Then, it does is apply a filter on all tables that have dates of application. Thus, for example, you may have to limit benefits to know those that this could be done using this SQL:
SELECT
ASSIGNMENT_ID, COST_ALLOCATION_KEYFLEX_ID, PROPORTION
Of
HR. PAY_COST_ALLOCATIONS_F
WHERE
SYSDATE BETWEEN EFFECTIVE_START_DATE AND EFFECTIVE_END_DATE
ORDER OF ASSIGNMENT_ID, COST_ALLOCATION_KEYFLEX_IDYou can get a clue by COUNT (*) from the two tables. If there are more records from a table that another so you can be sure that there is not a join one of 1:1 and therefore the granularity must be 1: n one-to-many
Hope this helps
Michael
Maybe you are looking for
-
does not load page correctly; works in IE and Chrome
Web page does not load positions on the right side of template joomla. This works in IE and Chrome. URL = www.vim-chatt.org
-
How to remove the warning of project
Hi all I use LabVIEW 8.6.1 here project window. How can I get rid of the warning displayed in the picture? The file has been moved as indicated. Refresh does not work, or save, I can't remove the warning tab 'Files' or 'Elements '. Any ideas? TIA -Ma
-
Establishment of a VISA for a TCP/IP connection
I'm writing a LabVIEW program that will allow me to recover data in my LeCroy Wavejet 354 and display them in a LabVIEW interface. I set ACIP of LeCroy passport. I have a problem ping from the unit so I know that my ethernet to the computer connect
-
After the Windows Vista updates, hard drive of the computer constantly "working".
Since the last microsoft automatic updates, my laptop is running continuously very strong as if if it does not work on something. It freezes now and then. I have a Samsung M60 and use Vista.
-
What is the chip attached to the lid back to?
Recently, I broke down my back. I bought a replacement official Amazon search and followed by a YouTube video of disassembly to replace. Once I removed the original back cover I found a print/chip circuit board glued to it is inside the surface. It h