Return the first line with a non-null value in a column
Hey there, gurus. Can someone give me a hand with this?I have a table with six columns: Class_ID, Course_ID, start_date, Last_Name, First_Name, company. When our students take a class and will fill in an evaluation form, they fill in the Class_ID Last_Name First_Name, and Company. The Course_ID and Start_Date are filled automatically based on the Class_ID.
I am trying to generate a report that contains Class_ID, Course_ID and Start_Date, PLUS the value of the first not null in the column of company for a combination given to the three first columns. Here is my SQL that does not quite do the trick:
Select distinct c.class_id, c.course_id, c.start_date, p.company
class c, person p, student s
where substr (c.course_id, 1, 3) = "OBI".
and c.start_date > = SYSDATE-30
and c.class_id = s.class_id
and s.pid = p.pid
order start_date, company, class_id, course_id
At present, if in a given class, a student entered "CCCC" under the name of the company and another entry "Collin Co Comm Coll" and another between "Collin College", I would get three rows of this class when you use the SQL above. I want just one line. I don't really like which company names gets selected - one of them will be great for our needs. I just need to see a line for each class_id and single value that some students entered the area of the company. And I guess I have to say that if no student fills in the name of the company I need to see the value null, because I need to see the line no matter what.
Looks like some sort of funky outer join or a coalesce, but it is beyond my ability to understand.
Now I get this:
During class 1234 SQL271 Date 22/07/2013 company XYZ Inc.
Made up of class 1234 SQL271 Date 22/07/2013 company XYZ
1234 SQL271 Date 22/07/2013 company XYZ, class
What I want:
Class 1234 SQL271 22/07/2013 Date course XYZ Inc. or one of the other 2
Thanks in advance!
select c.class_id, c.course_id, c.start_date, max(p.company) company
from class c, person p, student s
where substr(c.course_id,1,3) = 'OBI'
and c.start_date >= SYSDATE-30
and c.class_id = s.class_id
and s.pid = p.pid
group by c.class_id, c.course_id, c.start_date
order by class_id, start_date, course_id
Or if you want to list all businesses, you can use LISTAGG if you're on the latest version of ORACLE
Tags: Database
Similar Questions
-
Pulling on the first line with a value of repetition
Hello
We use the Oracle 11.1.
We have a table of postal codes.
We have several lines for each zip code because we have different areas that use the same zip code.
We want to reduce the lines of a line by zip code. But they said use they want to keep the fields that differ (neighborhood of the exodus).
Then they said "Just take the first value of each."
This code reduces the postcodes of a line by postal code, but as you can see I replaced the field with the name of the field values.
How should I take either one record per postal code with the first value in these fields orSELECT distinct ZIPCODE, CITY, STATE, COUNTY, AREACODE, 'CITYTYPE', CITYALIASABBREVIATION, 'CITYALIASNAME', LATITUDE, LONGITUDE, TIMEZONE, ELEVATION, COUNTYFIPS, DAYLIGHTSAVING, PREFERREDLASTLINEKEY, CLASSIFICATIONCODE, MULTICOUNTY, STATEFIPS, 'CITYSTATEKEY', 'CITYALIASCODE', 'PRIMARYRECORD', CITYMIXEDCASE, 'CITYALIASMIXEDCASE', STATEANSI, COUNTYANSI FROM zip_code GROUP BY ZIPCODE, CITY, STATE, COUNTY, AREACODE, CITYTYPE, CITYALIASABBREVIATION, LATITUDE, LONGITUDE, TIMEZONE, ELEVATION, COUNTYFIPS, DAYLIGHTSAVING, PREFERREDLASTLINEKEY, CLASSIFICATIONCODE, MULTICOUNTY, STATEFIPS, CITYALIASCODE, PRIMARYRECORD, CITYMIXEDCASE, STATEANSI, COUNTYANSI order by zipcode;
How should I take the first record for each zip code?
either way works for me.
Thank youHello
This is called a Query Top - N , and this is a way to do it:
WITH got_r_num AS ( SELECT z.* , ROW_NUMBER () OVER ( PARTITION BY zipcode ORDER BY city , ... -- add tie-breakers here ) AS r_num FROM zip_code ) SELECT * -- or list all columns except r_num FROM got_r_num WHERE r_num = 1 ;
You can simply use MIN or MAX on the columns, as the line with the name of the minimum city do not lowest have area code or the longitude. The above method preserves the first line of each zip code intact, where the 'first': the first in order of aphabetic by the name of the city. If it is not unique, then you may want breakage to the analytical ORDER BY clause.
If you are deleting rows, you can use this in a NOT IN subquery. If you copy lines to a new table, you can use the query above in an INSERT statement.
Published by: Frank Kulash, March 18, 2011 12:40
I just see Polywog response:
Pollywog wrote:
You can use the rank or rownumber function...If I understand the problem, you don't want to use RANK in this particular case. When there is equality, GRADE will assign 1 to all the contenders. I think the whole point of this thread is that you exactly want a #1 in each zip code, which is what ROW_NUMBER, but not RANK, guarantees.
-
Hello guys,.
I use a sql to sort a single column of a specific sort order, I need just the first returned row based on ID (doc_no) here is an example:
The result is:SQL> WITH 2 table_a AS ( 3 SELECT 1 doc_no, 'Description of 1' doc_desc FROM DUAL UNION ALL 4 SELECT 2, 'Description of 2' FROM DUAL), 5 table_b AS ( 6 SELECT 1 fk_doc_no, 'A' client_rev, TO_DATE ('10/10/2008', 'dd/mm/yyyy') due_date, 7 TO_DATE ('10/10/2008', 'dd/mm/yyyy') trans_date FROM DUAL UNION ALL 8 SELECT 1, 'B', TO_DATE ('05/11/2008', 'dd/mm/yyyy'), TO_DATE ('05/11/2008', 'dd/mm/yyyy') FROM DUAL UNION ALL 9 SELECT 1, '0', NULL, TO_DATE ('21/11/2008', 'dd/mm/yyyy') FROM DUAL UNION ALL 10 SELECT 2, 'A', TO_DATE ('25/11/2008', 'dd/mm/yyyy'), TO_DATE ('25/11/2008', 'dd/mm/yyyy') FROM DUAL UNION ALL 11 SELECT 2, '0', NULL, TO_DATE ('25/11/2008', 'dd/mm/yyyy') FROM DUAL) 12 SELECT x.doc_no, x.doc_desc, y.last_client_rev, y.due_date, y.trans_date 13 FROM (SELECT fk_doc_no, 14 MAX (client_rev) KEEP 15 (DENSE_RANK LAST ORDER BY TRANSLATE(client_rev 16 ,'ABCD012' -- Desired sort order 17 ,'012ABCD' -- Actual sort order 18 )) AS last_client_rev, 19 due_date, trans_date 20 FROM table_b 21 GROUP BY fk_doc_no, due_date, trans_date) y, 22 table_a x 23 WHERE x.doc_no = y.fk_doc_no;
The required data will be:DOC_NO DOC_DESC L DUE_DATE TRANS_DA ---------- ---------------- - -------- -------- 1 Description of 1 0 21/11/08 1 Description of 1 A 10/10/08 10/10/08 1 Description of 1 B 05/11/08 05/11/08 2 Description of 2 0 25/11/08 2 Description of 2 A 25/11/08 25/11/08
Can you help me with this?DOC_NO DOC_DESC L DUE_DATE TRANS_DA ---------- ---------------- - -------- -------- 1 Description of 1 0 21/11/08 2 Description of 2 0 25/11/08
Best regards.
BTW: I use Oracle 10 gHello
You don't need a subquerySELECT fk_doc_no, doc_desc, MAX (client_rev)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE (client_rev, 'ABCD012' -- Desired sort order , '012ABCD' -- Actual sort order )) AS last_client_rev, MAX (due_date)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE (client_rev, 'ABCD012' -- Desired sort order , '012ABCD' -- Actual sort order ), trans_date) due_date, MAX (trans_date)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE (client_rev, 'ABCD012' -- Desired sort order , '012ABCD' -- Actual sort order )) trans_date FROM table_a x, table_b y WHERE x.doc_no = y.fk_doc_no GROUP BY y.fk_doc_no, doc_desc
SQL> WITH table_a AS 2 (SELECT 1 doc_no, 'Description of 1' doc_desc 3 FROM DUAL 4 UNION ALL 5 SELECT 2, 'Description of 2' 6 FROM DUAL), 7 table_b AS 8 (SELECT 1 fk_doc_no, 'A' client_rev, 9 TO_DATE ('10/10/2008', 'dd/mm/yyyy') due_date, 10 TO_DATE ('10/10/2008', 'dd/mm/yyyy') trans_date 11 FROM DUAL 12 UNION ALL 13 SELECT 1, 'B', TO_DATE ('05/11/2008', 'dd/mm/yyyy'), 14 TO_DATE ('05/11/2008', 'dd/mm/yyyy') 15 FROM DUAL 16 UNION ALL 17 SELECT 1, '0', NULL, TO_DATE ('21/11/2008', 'dd/mm/yyyy') 18 FROM DUAL 19 UNION ALL 20 SELECT 2, 'A', TO_DATE ('25/11/2008', 'dd/mm/yyyy'), 21 TO_DATE ('25/11/2008', 'dd/mm/yyyy') 22 FROM DUAL 23 UNION ALL 24 SELECT 2, '0', NULL, TO_DATE ('25/11/2008', 'dd/mm/yyyy') 25 FROM DUAL) 26 SELECT fk_doc_no, doc_desc, 27 MAX (client_rev)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE 28 (client_rev, 29 'ABCD012' -- Desired sort order 30 , 31 '012ABCD' -- Actual sort order 32 )) AS last_client_rev, 33 MAX (due_date)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE 34 (client_rev, 35 'ABCD012' -- Desired sort order 36 , 37 '012ABCD' -- Actual sort order 38 ), 39 trans_date) due_date, 40 MAX (trans_date)KEEP (DENSE_RANK LAST ORDER BY TRANSLATE 41 (client_rev, 42 'ABCD012' -- Desired sort order 43 , 44 '012ABCD' -- Actual sort order 45 )) trans_date 46 FROM table_a x, table_b y 47 WHERE x.doc_no = y.fk_doc_no 48 GROUP BY y.fk_doc_no, doc_desc 49 / FK_DOC_NO DOC_DESC L DUE_DATE TRANS_DATE ---------- ---------------- - ---------- ---------- 1 Description of 1 0 2008-11-21 2 Description of 2 0 2008-11-25 SQL>
Published by: Salim champion 2009-01-26 06:47
-
Mr President.
My worm jdev is 12.2.1
How to enter two rows at the same time with different default values that only the first line to use see?
Suppose I have a table with four fields as below
"DEBIT" VARCHAR2(7) , "DRNAME" VARCHAR2(50), "CREDIT" VARCHAR2(7) , "CRNAME" VARCHAR2(50),
Now I want that when I click on a button (create an insert) to create the first line with the default values below
So if I click on the button and then validate the second row with different values is also inserted on commit.
The value of the second row are like the picture below
But the second row should be invisible. It could be achieved by adding vc in the vo.
The difficult part in my question is therefore, to add the second row with the new default values.
Because I already added default values in the first row.
Now how to add second time default values.
Concerning
Mr President
I change the code given by expensive Sameh Nassar and get my results.
Thanks once again dear Sameh Nassar .
My code to get my goal is
First line of code is
protected void doDML(int operation, TransactionEvent e) { if(operation != DML_DELETE) { setAmount(getPurqty().multiply(getUnitpurprice())); } if (operation == DML_INSERT ) { System.out.println("I am in Insert with vid= " + getVid()); insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE", (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } if(operation == DML_UPDATE) { System.out.println("I am in Update with vid= " + getVid()); updateSecondRowInDatabase(getVid(), (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } super.doDML(operation, e); } private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5) { PreparedStatement stat = null; try { String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " + "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')"; stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } } private void updateSecondRowInDatabase(Object value1, Object value5) { PreparedStatement stat = null; try { String sql = "update vdet set AMOUNT='"+ value5+"' where VID='" + value1 + "'"; stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } }
Second line code is inside a bean method
public void addNewPurchaseVoucher(ActionEvent actionEvent) { // Add event code here... BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator"); RowSetIterator rsi = dciter.getRowSetIterator(); Row lastRow = rsi.last(); int lastRowIndex = rsi.getRangeIndexOf(lastRow); Row newRow = rsi.createRow(); newRow.setNewRowState(Row.STATUS_NEW); rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow); rsi.setCurrentRow(newRow); BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator"); RowSetIterator rsi1 = dciter1.getRowSetIterator(); Row lastRow1 = rsi1.last(); int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1); Row newRow1 = rsi1.createRow(); newRow1.setNewRowState(Row.STATUS_NEW); rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1); rsi1.setCurrentRow(newRow1); }
And final saveUpdate method is
public void saveUpdateButton(ActionEvent actionEvent) { // Add event code here... BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry(); OperationBinding commit = bindingsBC.getOperationBinding("Commit"); commit.execute(); OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit"); operationBinding.execute(); DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef. iter.getViewObject().executeQuery(); }
Thanks for all the cooperation to obtain the desired results.
Concerning
-
Discover with function as datasource returns only the first line.
Hello
I created the following function to get the status of all the rules for the instances of SQL Server.
The data type of the function output has been configured as 'List of SQLInstanceRuleStatuss', where SQLInstanceRuleStatuss is the custom type, I created in the same module.
When I tested the function, it returns all instances of SQL Server with two other columns.
But when I try to create a view with the Rows property that is configured to use the feature, it returns only the first line:
sqlRules = new ArrayList();
queryStatement = server. QueryService.createStatement ("(DBSS_Instance)");
queryResult = server. QueryService.executeStatement (queryStatement);
for (it in queryResult.topologyObjects)
{
sqlRule is functionHelper.createDataObject ("westjet_mark_dev:SQLInstanceRuleStatus", "none", "test");.
sqlRule.instance = it;
sqlRule.ruleName = 'test rule name';
sqlRule.status = false;
sqlRules.add (sqlRule);
}
Return sqlRules;
Did I miss something?
Thank you
Mark
Mark,
I think I forgot something
sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none","test");
you create the test id
change your line of
sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none",null);
This should allow the creation of a single object in your loop for
-
Foreach returns only the first line of a dataset object
Hello, guys.
I am having trouble with a procedure in Oracle 9.2.0.1.0.
I have a query that returns the number of lines, but whenever I try to browse by using a foreach loop, I only get the first line and then the loop is completed.
For example, here's the query:
select ( CASE WHEN TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') < DATE '2009-01-01' THEN DATE '2009-01-01' ELSE TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY') END ) startdate, ( CASE WHEN TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') > DATE '2009-06-08' THEN DATE '2009-06-08' ELSE TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY') END ) enddate FROM dual CONNECT by trunc(DATE '2009-06-08','dd') >= add_months(trunc(DATE '2009-01-01','dd'),level - 1)
Who shows me this output:
STARTDATE ENDDATE 01/01/2009 2009-01-31 02/01/2009 28/02/2009 03/01/2009 31/03/2009 04/01/2009 30/04/2009 05/01/2009 31/05/2009 06/01/2009 06/08/2009 But whenever I run this code:
for rec in ( select ( CASE WHEN TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') < DATE '2009-01-01' THEN DATE '2009-01-01' ELSE TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY') END ) startdate, ( CASE WHEN TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'),'DD/MM/YYYY') > DATE '2009-06-08' THEN DATE '2009-06-08' ELSE TO_DATE( to_char(add_months(trunc(DATE '2009-01-01','mm'),level) -1,'dd') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'mm') || '/' || to_char(add_months(trunc(DATE '2009-01-01','mm'),level - 1),'yyyy'), 'DD/MM/YYYY') END ) enddate FROM dual CONNECT by trunc(DATE '2009-06-08','dd') >= add_months(trunc(DATE '2009-01-01','dd'),level - 1) ) loop DBMS_OUTPUT.put_line(TO_CHAR(rec.startdate, 'YYYYMMDD') || '-' || TO_CHAR(rec.enddate, 'YYYYMMDD')); end loop;
I get this result:
20090131 20090101
I tried debugging and I checked that the loop runs that once, and then passes the end of loop. I'm doing something wrong?
Thank you!
Best regards
Vinicius
Try:
for rec in
(
Select * from (select
(
CASE
WHEN
TO_DATE)
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "jj"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")< date="">
THEN DAY ' 2009-01-01'
ON THE OTHER
TO_DATE)
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "jj"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")
END
) startdate.
(
CASE
WHEN
TO_DATE)
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm') and level)-1, "dd"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), ' DD/MM/YYYY') > DATE '' 2009-06-08
THEN DAY '' 2009-06-08
ON THE OTHER
TO_DATE)
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm') and level)-1, "dd"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), "mm"). '/' ||
TO_CHAR (add_months (trunc (DATE ' 2009-01-01', 'mm'), level - 1), 'yyyy'), "DD/MM/YYYY")
END
) enddate
OF the double
CONNECT by trunc (DATE 2009-06 - 08 ',' dd') > = add_months (trunc (DATE 2009-01 - 01 ',' dd'), level - 1)
) )
loop
Dbms_output.put_line (TO_CHAR (rec.startdate, 'YYYYMMDD') |) '-' || To_char (rec.enddate, 'YYYYMMDD'));
end loop;
SY.
-
Replace the carriage return or new line with a table space
Hello
I want to replace the carriage return or new line with space in my column of the database.
To do this, I'm using this query:
Select replace (replace (Comments, chr (10),' '), Chr (13),' ') OF Comments_Master
Comments_Master is the name of the table and comments is column that contains carriage return or new line.
But this query works as expected.
Once I run this query and run the query again "select * FROM Comments_Master", transport return and new line still exist.
Please let me know what is wrong with this query?
You write that data back you? This example shows that your sql should work. I thinnk the query that you just described is the updated one below.
create table blah (text varchar2 (100));
insert into bla values (' it's multi)
line of text ");"
Select * from blah.
Select replace (replace (text, chr (10),' '), Chr (13),' ') of bla.
Update text bla = replace (replace (text, chr (10),' '), Chr (13),' ');
Select * from blah.
-
How can I change the first line of the table to a header row if it contains PGF with tblHead tags
So far, I have the following text in a JavaScript:
If (tbl. FirstRowInTbl.FirstCellInRow.FirstPgf.PgfFmt.Name = "tblHead")
{
If (tbl. FirstRowInTbl.RowType = 1).
1 is Constants.FV_ROW_BODY
tbl. FirstRowInTbl.RowType = 0;
0 is Constants.FV_ROW_HEADING
on the other
continue;
}
on the other
continue;
It does not work. I'm not comfortable with tbl. FirstRowInTbl.FirstCellInRow.FirstPgf.PgfFmt.Name.
It is clearly wrong. How I would I want to determine the tag of the first paragraph of the first line?
Any help is very appreciated!
Thank you
Ruth
Ruth, here is a function that converts the body lines to the header of a table lines. Please let me know if you have any questions or comments. -Rick
#target framemaker var doc = app.ActiveDoc; // Set a variable for the selected table. var tbl = doc.SelectedTbl; // Convert the first body row to a heading row. bodyToHeadingRow (tbl, 1, doc); function bodyToHeadingRow (tbl, num, doc) { var row = 0; // Select the top "num" rows in the table. tbl.MakeTblSelection (0, num - 1, 0, tbl.TblNumCols - 1); // Push the current clipboard contents and cut the selected rows. PushClipboard (); doc.Cut (Constants.FF_CUT_TBL_CELLS); // Add "num" number of heading rows to the table. row = tbl.FirstRowInTbl; row.AddRows (Constants.FV_Heading, num); // Select the new heading rows. tbl.MakeTblSelection (0, num - 1, 0, tbl.TblNumCols - 1); // Paste the rows from the clipboard into the new heading rows. doc.Paste (Constants.FF_REPLACE_CELLS); // Restore the clipboard contents. PopClipboard(); }
-
Problem with white - style commentary on the first line of the select statement.
SQL * more error? :
It seems that the parser does not like "-" at the end of the first line of the request.
I see this error "ORA-00936: lack of expression" or "ORA-00933: not correctly completed SQL command.
SQL * Plus costs number not the 2nd line when I do that.
If a space follows-, '-', I still get the error.
a single "-" at the end of the line is ignored and the query works
But, "-." will not get the error.
I think that I had this problem before on the inside in the middle of a procedure from PL/SQL package.
--
It is of course easy to avoid. Is this just a quirk or am I missing something?
-----
SQL * more: 9.0.1.4.0 output
Oracle Database 10 g Enterprise Edition release 10.2.0.3.0
---------------------------------------------- -- These provoke an error ---------------------------------------------- SQL select 'a' -- from dual; select 'a' - from dual * ERROR at line 1: ORA-00936: missing expression /* the -- is "-- " */ SQL select 'a','b','c' -- from dual; select 'a','b','c' - from dual * ERROR at line 1: ORA-00936: missing expression SQL select -- select 'a' from dual -- ; select - select 'a' from dual - * ERROR at line 1: ORA-00936: missing expression SQL select 'a' from dual -- ; select 'a' from dual - * ERROR at line 1: ORA-00933: SQL command not properly ended ---------------------------------------------- -- These are OK ---------------------------------------------- SQL select 'a' --. 2 from dual; ' - a Elapsed: 00:00:00.00 SQL select 2 'a' -- 3 from dual; ' - a ------- a single "-" at the end of the line is ignored, query works SQL select 'a' from dual - ; ' - a SQL
Actually, it's in the docs, but we rarely know.
>
Continuing a long SQL More control on additional lines *.
You can continue a long SQL * more command by typing a hyphen at the end of the line and press return. If you want, you can type a space before you type the hyphen. SQL * Plus displays a right angle (>) support as a prompt for each additional line (not in iSQL * more).For example:
SALARY $99 999 COLUMN FORMAT-
SECTION "WAGES."
Since SQL * Plus identifies the hyphen as a continuation character, entering a hyphen in a statement SQL is ignored by SQL * more. SQL * more does not identify the declaration as a SQL statement until after the treatment of entry has joined lines together and removed the hyphen. For example, enter the following:SELECT - 200
100 DOUBLE;
Returns the error:>
It only happens for the first line of a sql statement, because at that time there you are not in the edit buffer. And the order could still be a sql * more order and not a sql command.
Published by: Sven w. on August 7, 2009 16:51
-
Hi all
We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.
We created a table ADF programming related to a SortableModel created programmatically to a bean.
We need to select and highlight the first row in the table just after making it to retrieve data based on the first line.
We tried the based on the following thread: How to call the bean support just after JSFF / page fragment loads? and a few other posts online, but it does not work very well.
W has created a hidden text in the bottom of the JSF model as follows:
< af:table varStatus = "rowStat" Summary = "table" value = "#{pageFlowScope.crudBean.dynamicTable.collectionModel} '"
Rows = "#{pageFlowScope.crudBean.dynamicTable.collectionModel.RowCount} '"
contentDelivery = 'immediate' var = 'row' rendered = 'true '.
Binding = "#{backingBeanScope.crudBackingBean.tasksTable} '"
selectionListener = "#{backingBeanScope.crudBackingBean.customListener} '"
"rowSelection ="single"id ="t1"partialTriggers =": pt_gr2 "columnStretching =" column: clmn0 ">
< af:forEach items = "#{pageFlowScope.crudBean.dynamicTable.columnNames}" var = 'name' varStatus 'vs' = > "
< af:column sortable = "true" sortProperty rowHeader = "#{name}" = "no style" headerText = "#{pageFlowScope.crudBean.dynamicTable.columnLabel [name]}" "
inlineStyle = "width: 100px;" ID = "clmn$ {vs.index}" >
< af:activeOutputText value = "#{row [name]}" id = "aot1" / >
< / af:column >
< / af:forEach >
< / af:table >
....
< af:outputText id = "hiddenOutputTextId" visible = "false" value = "#{backingBeanScope.crudBackingBean.afterPageLoad} '"
Binding="#{backingBeanScope.crudBackingBean.hiddenOutputText}"/ >
And we have added the code to the bean to support below:
public String getAfterPageLoad() {}
If (!.) {AdfFacesContext.getCurrentInstance () .isPostback ()}
selectFirstRowInTasksTable();
}
Return afterPageLoad;
}
public void selectFirstRowInTasksTable() {}
try {}
RKS RowKeySet = new RowKeySetImpl();
RowKeySet rksEmpty = new RowKeySetImpl();
Model CollectionModel = tasksTable.getValue ((CollectionModel));
ROWCOUNT int = model.getRowCount ();
If (rowcount > 0) {}
model.setRowIndex (0);
Key of the object = model.getRowKey ();
RKS. Add (Key);
tasksTable.setSelectedRowKeys (rks);
SelectionEvent selectEvent =
new SelectionEvent (tasksTable.getSelectedRowKeys (), rks, tasksTable);
selectEvent.queue ();
customListener (selectEvent); / / to retrieve data
AdfFacesContext.getCurrentInstance () .addPartialTarget (tasksTable);
}
} catch (Exception e) {}
}
}
I think that () selectEvent.queue; should work even without calling the customerListener, but it is not working in all cases.
What is the problem in my code?
Have you tried to bind property of 'selectedRowKeys' to selection configuration / bean there?
Something like:
public RowKeySet getSelectedRKS() { if (rks == null) { // make first record as selected // create RowKeySet and assign it to rks variable(where rks is variable defined in bean with some scope higher than request scope) } return rks; }
Dario
-
How do to "BOLD" in the first line of text on a number of sections of text at a time
CS5 using (but we have CS5
.5 available) we will create a business directory. Each page has columns of type
business listings with the company name on top, under this address under this phone, etc. Each ad is separated
by a single line. There are thousands of ads, and we need to "BOLD" in the top line of each. How can do us
without making them individually?
Each line a paragraph, or each list a paragraph with soft returns (forced line breaks)?
It's very simple and basic in both cases an operation. It is especially easy if each ad has the same number of lines, so we will focus first with this case.
Each line should be a separate paragraph. If you have 4 lines, as your example, you might want to mention their name, street, city, and phone. You can and should, all the styles that will be similar in appearance on the same basic model and change only the atrributes that are different, so, for example, if all lines use the same font, many use the same size and weight and only the top line is different and only by being "BOLD" and or larger size start by defining the street, then city and phone based Street and you don't need to define something more than the next Style, I'll get to in a second.
For topics, set name based as well on the street, but change the font characters. Now all the features of the basic fonts can be changed in one place, the definition of the style Stree.
Since you have the same number of lines in each list, you can set up a loop "next style". For name, style next street is, the street is the city, for the city it is the phone and is name for the phone. You will also need to toe after the add space in the name, or space on the phone to book spaces registration and you probably also consider to assign everything except phone keep with the next line to prevent a list from breaking across a page or column break. If currently you have blank lines as separators (empty paragraphs), get rid of them. There are change queries find already registered in ID that will do that.
Once the text is in place and the styles are defined, you can select all, then right click on the style name in the paragraph Styles Panel and choose apply following Style and name. Reformatted your entire list. IT IS CRITICAL in this method that the structure of each list is identical, and if there are no empty lines between the lists.
If each line is a paragraph, but there is line different counts, you will probably reach with just two styles, one for the headings oand one for everything else, but the beat of following style will not work. If there is something unique that appears in all the headings you can use find/replace to make search and reformat in shape, but I suspect that this will not be the case on in the real world, there will be a manual work involved.
Where a lisitn is a single paragraph, line break forced (which is better suited to the case of an uneven lines by registration number) you can define a character style nested to be applied by means of a line break forced to make the first line "BOLD", red or any other thing you want.
At this point, you are probbly, noting that a bit before planningn is a good idea when you do a directory so that your ads have some sort of coherent structure that allows for automation. I have no idea whre that your text is coming from or how it is done in the code. If it can be established as a .csv or a tab-delimited text file, you can use data merge to fill a file based on a model of merge (i.e., how to build directories for my clients who need). You can set styles in the model to each field or paragraph that contains several fields, and merge data will remove empty lines if all row fields are null and there is no punctuation or whitespace on the line.
A multiple records per page fusion will give you individual blocks of text for each record, and you can, if you wish, thread them using the script text point of Rorohiko.com.
-
Pleazzz... help me put my record of the opening on the first line
I use this query inside my builder6 (oracle10g) report, but it is untimely return of output.
only when I give the start date of the report (: m_frm_date) as the opening date (op_date), the balance
the report that is stored in the table op_bal, happens correctly, with the first line, the opening balance.
later, when I try to run the same report giving other start dates, opening balance
line was traded to the second row. Please refer to the screenshot of my reports, for the best idea.
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT.jpgselect op_date, TNO,OP_CODE,EI,withdrawal,deposit, sum(NVL(DEPOSIT,0)-NVL(WITHDRAWAL,0)) over (order by op_date,TNO) bal from ( select op_date, NULL TNO,null OP_CODE,NULL EI,withdrawal,deposit from ( select :M_FRM_DATE op_date, sum(withdrawal) withdrawal, sum(deposit) deposit from ( select :M_FRM_DATE op_date,sum(DECODE(EXPN_EI,'E',EXN_AMOUNT)) WITHDRAWAL, sum(DECODE(EXPN_EI,'I',EXN_AMOUNT)) DEPOSIT from EXPENSES_TXN, expense_master where exn_acnt_code = expn_code and exn_date < to_CHAR(:M_FRM_DATE,'dd/mm/yyyy') union all select op_date, null withdrawal, op_amount deposit from op_bal)) union all SELECT EXN_DATE, EXN_NO, EXN_ACNT_CODE, EXPN_EI, DECODE(EXPN_EI,'E',EXN_AMOUNT) WITHDRAWAL, DECODE(EXPN_EI,'I',EXN_AMOUNT) DEPOSIT FROM EXPENSES_TXN, EXPENSE_MASTER WHERE EXN_ACNT_CODE = EXPN_CODE and EXN_DATE between to_CHAR(:M_FRM_DATE,'dd/mm/yyyy') and to_CHAR(:M_UPTO_DATE,'dd/mm/yyyy')) order by op_DATE,tno / this is the actual for which report has to come; SQL> select * from op_bal; OP_COD OP_NAME OP_DATE OP_AMOUNT ------ ------------------ --------- ------------- OP0000 NATIONAL BANK 01-JAN-09 5000.000 *Date No.2* SQL> SELECT 2 EXN_DATE, 3 EXN_NO, 4 EXN_ACNT_CODE, 5 EXPN_EI, 6 DECODE(EXPN_EI,'E',EXN_AMOUNT) WITHDRAWAL, 7 DECODE(EXPN_EI,'I',EXN_AMOUNT) DEPOSIT 8 FROM EXPENSES_TXN, EXPENSE_MASTER 9 WHERE EXN_ACNT_CODE = EXPN_CODE 10 order by 1; EXN_DATE EXN_NO EXN_AC E WITHDRAWAL DEPOSIT --------- ------------- ------ - ------------- ------------- 01-MAR-09 2.000 AC0002 E 2000.000 10-MAR-09 7.000 AC0012 I 500.000 15-MAR-09 5.000 AC0007 E 15.000 20-MAR-09 8.000 AC0012 I 700.000 31-MAR-09 6.000 AC0008 E 30.000 01-APR-09 9.000 AC0013 I 250.000 07-APR-09 1.000 AC0001 E 200.000 09-APR-09 4.000 AC0011 E 35.000 09-APR-09 3.000 AC0003 E 50.000 9 rows selected.
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT1.jpg
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT2.jpg
much appreciated, tyvm.Hello
Is the problem that, when it is be a rank with exn_date =: m_frm_date, the line which represents the total front: m_frm_date sometimes appears after him?
If Yes, then you must add something to the ORDEER TO ensure that the total line comes first.
If NWT is NULL rfor only the total row, and then, as said to put, simply add 'NULLS FIRST' to "ORDER BY tno". Don't forget to do this as well in the analytical AGENDA BY:OVER (ORDER BY op_date, tno NULLS FIRST) AS bal
towards the beginning of your query and the result ORDER BY value at the end:
ORDER BY op_date, tno NULLS FIRST;
If reallly NWT can be null, you can create a new column (I'll call her sort_key) ust to distinguish the total line on the lines later. SELECT a literal 1 sort_key of ACE in the part of the UNION that created the total line, and then '2 AS sort_key' in the part of the UNION, who gets lines and after: m_frm_date:
SELECT op_date, tno, op_code, ei, withdrawal, deposit, SUM ( NVL (deposit, 0) - NVL (withdrawal, 0) ) OVER (ORDER BY op_date, sort_key, tno) AS bal FROM ( SELECT TO_DATE (:m_frm_date, 'dd/mm/yyyy') AS op_date, NULL AS tno, NULL AS op_code, NULL AS ei, withdrawal, deposit, 1 AS sort_key FROM ( -- Begin sub-query for expenses before :m_frm_date SELECT TO_DATE (:m_frm_date, 'dd/mm/yyyy') AS op_date, SELECT SUM (withdrawal) AS withdrawal, SUM (deposit) AS deposit FROM ( SELECT SUM (DECODE (expn_ei, 'E', exn_amount)) AS withdrawal, SUM (DECODE (expn_ei, 'I', exn_amount)) AS deposit FROM expenses_txn, expense_master WHERE exn_acnt_code = expn_code AND exn_date < TO_DATE (:m_frm_date, 'dd/mm/yyyy') UNION ALL SELECT NULL AS withdrawal, op_amount AS deposit FROM op_bal ) ) -- End sub-query for expenses before :m_frm_date UNION ALL SELECT exn_date, exn_no, exn_acnt_code, expn_ei, DECODE (expn_ei, 'E', exn_amount) AS withdrawal, DECODE (expn_ei, 'I', exn_amount) AS deposit, 2 AS sort_key FROM expenses_txn, expense_master WHERE exn_acnt_code = expn_code AND exn_date BETWEEN TO_DATE (:m_frm_date, 'dd/mm/yyyy') AND TO_DATE (:m_upto_date,'dd/mm/yyyy') ) ORDER BY op_date, sort_key, tno;
Be sure to use strings to represent DATEs. If: m_frm_date is a string, it must always be used with TO_DATE and TO_CHAR ever.
Never, send or even write, unformatted code.
During the validation of code on this site, type the 6 characters
{code}
(small letters only, inside curly braces) before and after the code for formatting, to keep the spacing. -
Scan of a file only works on the first line
Hello
I'm new to Labview (see 8.6) and I'm running on this problem.
I use the Scan of a file to get a certain amount of information for the installation of test.txt. The data of the file looks like this:
AAA 1
BBB 2
REC 3
I noticed that the Scan of the file works for only the first line. Trying to get data that are not in the first line results in an error 85.
Any ideas? Thank you
It's all in what the scan of the file reads, and what is the next cgaracter in the file.
Your first analysis of the file reads up to but NOT including the first newline in the file.
The second read readings where the first reading was arrested and is expected to see 'B' as the next character, but sees the new line instead, and if the analysis fails. You must specify second reading formatted to await the return line.
You can do this by making the FIRST character of the format string space, that will tell it to expect a number any of charaters 'white space '.
Yo can indeed put a space at the beginning of the format string in your first analysis of the file and it will match with zero white space characters before you see the AAA. By doing this he also tolerate to see the spaces and tabs before your AAA or BBB identifiers.
Rod.
-
Delete in af:table always remove the first line when using ExecuteWithParams
Hello world
I got a page with master form and af:table two details related to the master. When I'm trying to remove a line in an af:table of detail, it always removes the first line, any line, I selected before. The table has a single = rowSelection and the line is properly visually selected. I remove the line using a "delete hyperlink" on each line, but I first have to select the line. Delete called a bond (or a method at the bean by removing the current line of the iterator, I tried both, none of them work)
Links page has an ExecuteWithParams defining the correct ID to edit on the master of iterator and an InvokeExecuteWithParams the renderModel value. If I put the refresh condition zero and I hard-code an ID in the binding variable in the model, I am able to delete the selected line.
In addition, I don't know if this information is useful, but if I set the iterator to PPR ChangeEventPolicy, when I select a line, there always select the first line.
Any ideas what I could do wrong? Is this a bug?
I use JDev 11.1.1.7
Thank you
Guillaume
You can try creating a method in ApplicationModule for filter master records instead of executeWithParams?
Ashish
-
make the first line of each paragraph "BOLD"
Hi all
I read this forum, but I can't really find the answer, I need.
Here's my problem, we intend to automate the flow of text in our Organization, that's what I have to do
-read the input from the story of a database
-flow text into a text box in particular for example 4.5 cm wide
-each paragraph will be had 2 new lines
-Select the first line of each paragraph then putting in bold.
in the above list, I can do everything except the first paragraph selection and putting in bold. I am looking for the selection of text I see there is a function called textframe.select?
Can someone help me with this please?
This severely reduced your options. (Which reminds me, you can specify a detail important like that from the beginning the next time.)
The simple solution would be to apply your "BOLD" font (or better: a character style) in the first line of each paragraph by using the property of a paragraph .lines. UH customary ‑‑ link to the HTML version of the omitted OMV, it seems I'm not coming back as much as CS2... (Is there a CHM for it to http://www.jongware.com/idjshelp.html).
This should work:
App.Selection [0] .paragraphs [0]. Lines [0] .appliedCharacterStyle = "YourBoldCharStyle";
... With your cursor in the paragraph you want to change. Will adjust to meet your specific needs.
There is a drawback of the simple method. Unless you use a special police who makes bold with the same width as her (quite rare) usually, the text will be redistributed after he applied. So there are one or more words in bold on the next line, so you must remove the tank style "BOLD" of those. But! At that time InDesign may determine that these non-bold words may go back on the first line!
Well written code does not help, because it could be possible the same word oscillates backwards with each change between the first and the second line, each time to cheat... At * some * point you'll have to help the poor ID a bit; perhaps to fix this first line with No Break applied.
Maybe you are looking for
-
original title: installation FIXIT I try to install the progrsm Fixit and it does not allow me to make the race he leaves on the download?
-
* XP.* The file is located in c:\windows\system32(* But one) glary utilities stop it on start up(* b) dates are meaningless: it was 'created Sunday, 25august 2030"(it is two - thousand-and-thirty AD).* I would be grateful if someone could explain if
-
Access invited E3000 and static IP addresses
I have an E3000 I just put in place. I have two questions: 1 > I'm replacing a WRT110. I had the old router with a static IP address provided by my ISP. I have configured the E3000 with the same address and I can't access the internet. Are there tips
-
DeskJet 5740: Replaced bkack ink does not
Black ink ran out of my deskjet 5740. I stopped by a store to buy a replacement. The associate gave me 96 black. On the side of the box it says it is compatible with the Deskjet5740. When I got home and succeeded him and tried to copy something it wo
-
Is quicken Deluxe 2012 compatible with windows 8
Is quicken Deluxe 2012 compatible with windows 8