RFC - XI - JDBC(mapping only the last row of a record)
Hello all,
in a mapping response from an oracle base after a RFC call with a select statement, i have the following response :
<StatementSelect_response>(cardinality 0..1)
<row1>(cardinality 0..unbounded)
<field1>1</field1>
<field2>2</field2>
</row1>
<row2>
<field1>3</field1>
<field2>4</field2>
</row2>
</statement>
i have to map those fields in a RFC_response like :
<RFC_response>(0..1)
<field1>
<field2>
</rfc _response>
Problem : I only need to send back to the rfc_response the last records of my StatementSelect_response in order to have the following message :
<RFC_response>
<field1>3
<field2>4
</rfc _response>
How can i select only the last row of my records plz ?
Thanks by advance
VJ wrote:>
> Hi,
>
> public void LastRow(String[] a,ResultList result,Container container){
>
> int len = a.length();
> Result.addValue(a\[len-1\]);
>
> }
VJ,
Please don't confuse him. If you want to update the thread, let me leave it aside.Coz it shouldn't cause him trouble. Can u check a.length() is correct? it has to be a.length, isn't it?
We all here to help others, not under any motivation of compete..
Sorry, if I hurt you..
raj.
Similar Messages
-
Hello Guys,
I am trying to build a sinogram from 180 projection images and I am not able to store the summed values into the array as it is moving the values and then populating all the rows except for the last with ZERO.
Thanks in advance.
Attachments:
sinogram.vi 53 KBYour loop runs only three times, so all you can possibly populate is 3 rows.
Typically, you would initialize a shift register with the initialized array, then use replace array subset, feeding the modified array back into the shift register. However, in this case you could just autoindex the 1D array at the output tunnel to build the resulting 2D array.
Sorry, I am not familiar with sinograms. Do you have a link describing the algorithm?
LabVIEW Champion . Do more with less code and in less time . -
How to get the last row in a resultset or query
Hi All
Say If I have a complex query which returns a resultset say 15 rows. Now I want to limit the output showing only the last row.
How can we do thisKeep in mind Oracle does not keep "row" order as such. Unlike a graphical type db like Access, Oracle will not always give you back the results in order.
Even if you were to use a sequence, your query is never guaranteed to give back the results in the order you are expecting. You must then give an order by statement to all queries expecting the order.
Your definition of last row too is vague - if it is in fact the greatest amount, use the inline view suggestion. If you simply want to see the last inserted row, consider adding a last_update_date column inserting the sysdate (by a trigger perhaps). This would then allow you to see the last inserted row.
Enjoy! -
How can I get only the last 2 rows?
How can I narrow down a query to get only the last two rows in a table ?
Thanks,
MohanThanks a lot Ram for your suggestion but already I have a query which returns a set of rows, of which I would like to further filter and get the last two rows
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Ramanuj Bangad ([email protected]):
try out something like this if it helps.
Example:
select * from users
where rownum <= (select count(*) from users)
minus
select * from users
where rownum <= (select count(*) -2 from users )
<HR></BLOCKQUOTE>
null -
How to get the last row of a database table.
HI ,
I want to get record exactly from the last row of a database table.
How is that possible?Hi,
To fetch last record from an internal table, just do find the number of records in it and read using index.
DESCRIBE TABLE ITAB LINES L_LINES.
READ TABLE ITAB INDEX L_LINES.
You can also use LOOP .. ENDLOOP but the above method is better (performance wise).
using LOOP .. ENDLOOP.
LOOP AT ITAB.
**do nothing
ENDLOOP.
**process ITAB (Header record of ITAB).
**after ENLOOP, ITAB will have the last record of the internal table.
[here ITAB is internal table as well as header record.]
But what is the requirement?
If you are looking for the current record of an employee then you can use ENDDA = HIGH_DATE.
My advice is to review your requirement again and try to fetch only that record which you need.
Mubeen -
HELP! How te retrieve the last row in MYSQL database using Servlet!
Hi ,
I am new servlets. I am trying to retireve the last row id inserted using the servlet.
Could someone show me a working sample code on how to retrieve the last record inserted?
Thanks
MY CODE
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class demo_gr extends HttpServlet {
//***** Servlet access to data base
public void doPost (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
String url = "jdbc:mysql://sql2.njit.edu/ki3_proj";
String param1 = req.getParameter("param1");
PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
String semail, sfname, slname, rfname, rlname, remail, message;
int cardType;
sfname = req.getParameter("sfname");
slname = req.getParameter("slname");
rfname = req.getParameter("rfname");
rlname = req.getParameter("rlname");
semail = req.getParameter("semail");
remail = req.getParameter("remail");
message = req.getParameter("message");
//cardType = req.getParameter("cardType");
cardType = Integer.parseInt(req.getParameter("cardType"));
out.println(" param1 " + param1 + "\n");
String query = "SELECT * FROM greeting_db "
+ "WHERE id =" + param1 + "";
String query2 ="INSERT INTO greeting_db (sfname, slname ,semail , rfname , rlname , remail , message , cardType ,sentdate ,vieweddate) values('";
query2 = query2 + sfname +"','"+ slname + "','"+ semail + "','"+ rfname + "','"+ rlname + "','"+ remail + "','"+ message + "','"+ cardType + "',NOW(),NOW())";
//out.println(" query2 " + query2 + "\n");
if (semail.equals("") || sfname.equals("") ||
slname.equals("") || rfname.equals("") ||
rlname.equals("") || remail.equals("") ||
message.equals(""))
out.println("<h3> Please Click the back button and fill in <b>all</b> fields</h3>");
out.close();
return;
String title = "Your Card Has Been Sent";
out.println("<BODY>\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" );
out.println("\n" +
"\n" +
" From " + sfname + ", " + slname + "\n <br> To "
+ rfname + ", " + rlname + "\n <br>Receiver Email " + remail + "\n<br> Your Message "
+ message + "\n<br> <br> :");
if (cardType ==1)
out.println("<IMG SRC=/WEB-INF/images/bentley.jpg>");
else if(cardType ==2) {
out.println("<IMG SRC=/WEB-INF/images/Bugatti.jpg>");
else if(cardType ==3) {
out.println(" <IMG SRC=/WEB-INF/images/castle.jpg>");
else if(cardType ==4) {
out.println(" <IMG SRC=/WEB-INF/images/motocross.jpg>");
else if(cardType ==5) {
out.println(" <IMG SRC=/WEB-INF/images/Mustang.jpg>");
else if(cardType ==6) {
out.println("<IMG SRC=/WEB-INF/images/Mustang.jpg>");
out.println("</BODY></HTML>");
try {
Class.forName ("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection
( url, "*****", "******" );
Statement stmt = con.createStatement ();
stmt.execute (query2);
//String query3 = "SELECT LAST_INSERT_ID()";
//ResultSet rs = stmt.executeQuery (query3);
//int questionID = rs.getInt(1);
System.out.println("Total rows:"+questionID);
stmt.close();
con.close();
} // end try
catch (SQLException ex) {
//PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
while (ex != null) {
out.println ("SQL Exception: " + ex.getMessage ());
ex = ex.getNextException ();
} // end while
} // end catch SQLException
catch (java.lang.Exception ex) {
//PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
out.println ("Exception: " + ex.getMessage ());
} // end doGet
private void printResultSet ( HttpServletResponse resp, ResultSet rs )
throws SQLException {
try {
PrintWriter out = resp.getWriter();
out.println("<html>");
out.println("<head><title>jbs jdbc/mysql servlet</title></head>");
out.println("<body>");
out.println("<center><font color=AA0000>");
out.println("<table border='1'>");
int numCols = rs.getMetaData().getColumnCount ();
while ( rs.next() ) {
out.println("<tr>");
for (int i=1; i<=numCols; i++) {
out.print("<td>" + rs.getString(i) + "</td>" );
} // end for
out.println("</tr>");
} // end while
out.println("</table>");
out.println("</font></center>");
out.println("</body>");
out.println("</html>");
out.close();
} // end try
catch ( IOException except) {
} // end catch
} // end returnHTML
} // end jbsJDBCServletI dont know what table names and fields you have but
say you have a table called XYZ which has a primary
key field called keyID.
So in order to get the last row inserted, you could
do something like
Select *
from XYZ
where keyID = (Select MAX(keyID) from XYZ);
Good Luckwhat gubloo said is correct ...But this is all in MS SQL Server I don't know the syntax and key words in MYSQL
This works fine if the emp_id is incremental and of type integer
Query:
select *
from employee e, (select max(emp_id) as emp_id from employee) z
where e.emp_id = z.emp_id
or
select top 1 * from employee order by emp_id descUday -
How to get the only the last raw of the table
Hello All,
While fetching a table into internal table, how to get only the last record of the table.?
Thanks and Regards, PradeepI hope following code will solve your problem.
DATA : it_bseg TYPE TABLE OF bseg,
x_bseg TYPE bseg,
v_index TYPE i.
SELECT COUNT(*)
FROM bseg
INTO v_index.
SELECT *
FROM bseg
INTO TABLE it_bseg.
READ TABLE it_bseg INTO x_bseg INDEX V_INDEX.
First SELECT will give you the number of rows in a table in v_index. Second SELECT will fetch all table data and then READ will give you the last record of the table in a structure x_bseg.
Reward points if the answer is helpful. -
IBM SVC console uses websphere. Screen data that is presented in table form last row appears to overwrite the prior row only. In other similar layouts, the last row is cut in half and cannot be seen. The prior version of Firefox 3 (something) did not have this problem. OS Windows XP Pro SP3
Firefox V3.6.17 worked fineSeeing the same problem using the HMC with FF7 beta.
-
I have 10 rows in my table and I have to retrive last row using rownum.
For this I use
SELECT * from <table_name>
where rownum<=10
minus
SELECT * from <table_name>
where rownum<=9
The result is no rows selected
In the same case if I use
SELECT rownum from <table_name>
Where rownum <= 10
minus
SELECT rownum from <table_name>
where rownum <=9
The result is 10
Why this happend.
If the result is 10, then why the row whose rowid is 10 is not retrivedAll
Please bear in mind that ROWNUM is an attribute of the query NOT the table. The last row returned by an unORDERed SELECT statement may be the most recently inserted row but is not guaranteed to be so.
The only way of assuring yourself of returning the most recent row is either to timestamp all your tables with a date_created column or to use a primary key with an ascending value.
rgds, APC -
How do I remove the last row in a csv data file
I would like to remove the last row of data from a csv file that I have saved. I can identify the start byte of the last row; however, I'm not sure what tool is the best one to remove it. Should I move the EOF? Should I open the file up to that point then save over the old one? Is there another way I don't know about? I am using labview 7.1.
ThanksI would use the Read Text File. You can right-click on it and tell it to read lines. Then Delete From Array. Leave the index and length unwired and it will delete the last item (I noticed your code is removing the second line). Then open the file again set to replace or create and write your data. This method allows you to propagate your errors instead of the Write/Read Spreadsheet File handling the errors for you.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Remove last row of csv_BD.png 14 KB -
Get rows where the last row finish off
Hi, i have two tables AND would LIKE TO get data BY combining both.
here IS my data
WITH hist AS
SELECT To_Date('4/23/2010','mm/dd/yyyy') dt, 999 alias, 'PROC' dom FROM dual UNION ALL
SELECT To_Date('4/27/2010','mm/dd/yyyy') dt, 999 alias, 'LON' dom FROM dual UNION all
SELECT To_Date('4/1/2010','mm/dd/yyyy') dt, 111 alias, 'SOC' dom FROM dual UNION all
SELECT To_Date('4/10/2010','mm/dd/yyyy') dt, 111 alias, 'NAO' dom FROM dual UNION ALL
SELECT To_Date('3/23/2010','mm/dd/yyyy') dt, 222 alias, 'PSE' dom FROM dual
final AS
SELECT To_Date('2/26/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
SELECT To_Date('4/22/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION all
SELECT To_Date('4/26/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
SELECT To_Date('4/30/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
SELECT To_Date('2/25/2010','mm/dd/yyyy') dt, 111 alias FROM dual UNION ALL
SELECT To_Date('2/26/2010','mm/dd/yyyy') dt, 222 alias FROM dual UNION ALL
SELECT To_Date('4/22/2010','mm/dd/yyyy') dt, 222 alias FROM dual UNION all
SELECT To_Date('4/26/2010','mm/dd/yyyy') dt, 222 alias FROM dual
the output should be as follow(without the extra blank line of course)
DT ALIAS DOM
2/26/2010 999 PROC
4/22/2010 999 PROC
4/26/2010 999 LON
4/30/2010 999 LON
4/27/2010 999 LON
4/23/2010 999 PROC
2/25/2010 111 SOC
4/1/2010 222 SOC
4/10/2010 222 NAO
2/26/2010 222 PSE
4/22/2010 222 PSE
4/26/2010 222 PSEso what i am doing here is as follow, take one row in hist table (4/23) and join with final table and give me all rows in final table
where dt <= to the row in hist table and include the row from hist table.
this logic will give me rows 2/26/2010,4/22/10 4/23/2010
then the second row in hist table (4/27/2010) wiill get all rows
in final table that is <= to the current row and pick up the rows starting from the row > than the last row where the 4/23/2010 finished off
in this case the output will be 4/26/10, 4/27/2010(we need to include row from hist)
since there is no row in hist that is greater than 4/30/2010, this date will still be display and dom column value should be taking from the max date in hist
which is 4/27/2010. see output above
this sound a little confusing to explain but look at output of what to expect as output. the other ids should follow the same logic
can someone help write a query for this? thanksHi,
Devx wrote:
Frank, thanks again, i ran the query in oracle 11g and oracle 9i. 11g runs ok but 9i doesnt. it looks like the ignore null option is not supported in 9i. That's right: IGNORE NULLS was new in Oracle 10. You should always mention your Oracle version whenever you ask a quiestion, especially if it's as old as Oracle 9.
i will be running this query in 9i. is there any alternative to re-write this query without using last value since ignore null is not supported and the output is not as i expected when i take that keyword out.
i really appreciate your help. please let me know how would i re-write the query. thanksOne work-around is to use LEAD or LAG instead of LAST_VALUE. This means you have to know exactly where (how many rows away) the most recent non-NULL value is, which in turn requires other analytuic funtions, such as ROW_NUMBER, and more sub-queries:
WITH combined_tables AS
SELECT dt, alias, NVL (dom, '_?_') AS dom FROM hist
UNION
SELECT dt, alias, NULL AS dom FROM final
, got_r_num AS
SELECT dt, alias, dom
, ROW_NUMBER () OVER ( PARTITION BY alias
ORDER BY dt
) AS r_num
, COUNT (*) OVER ( PARTITION BY alias
) AS alias_cnt
FROM combined_tables
, got_skip_cnts AS
SELECT dt, alias, dom, r_num
, r_num - MAX (CASE WHEN dom IS NOT NULL THEN r_num END)
OVER ( PARTITION BY alias
ORDER BY r_num
) AS skip_before
, MIN (CASE WHEN dom IS NOT NULL THEN r_num END)
OVER ( PARTITION BY alias
ORDER BY r_num DESC
) - r_num AS skip_after
FROM got_r_num
, got_next_dom AS
SELECT dt, alias, dom, r_num, skip_before
, LEAD (dom, skip_after) OVER ( PARTITION BY alias
ORDER BY r_num
) AS next_dom
FROM got_skip_cnts
SELECT dt
, alias
, NULLIF ( COALESCE ( next_dom
, LAG (dom, skip_before) OVER ( PARTITION BY alias
ORDER BY r_num
) AS dom
FROM got_next_dom
ORDER BY alias
, dt
;You should be able to calculate bot LEAD and LAG in the same query, but there seems to be a bug that only calculates one of them correctly in this case. The sub-query got_next_dom gets around that, by doing the LEAD in a separate sub-query. -
Hiding bloc of Lines in a web template in the last row
Hello,
I want to hide a bloc of lines in a web query.
Here I use the table interface with the method
characteristic cell according to the "How to" - paper
(How to hide a column).
Normally , there is no problem to set the tag
'<!--' in the first column ot the row to be suppressed and the tag
'-->' in the first column of the row, I want to display again.
But the problem is the last row. Here I must close the
tag in the last column of the last row. The effect is
something like a double line at the end of the output.
(I think, I see here another time the first column of
a row, because I cannot close the tag properly)
As a result, I have problems with the print manager, we use to enhance the web printing.
Can someone give me the information, how to close the tag
in a proper way at the last row.
Many thanks for your help.
Regards
RalphHi,
I don't think this is possible. I would try to use c_cell_extend to extend the style of each <td>-Tag with style="visibility:hidden; display:none" This should have the same affect (for all cells which have to be hidden) (depending on your table styles there might be some padding or spacing effects; you have to try this out).
Heike -
How can I delete the last row of a Matrix
Hi All,
Does anyone know whether deleting the last row of a matrix controlled by a UDO child table gives problems? I have the strange effect that I cannot delete the very last existing row in the matrix, i.e. after updating the delete the last to-be deleted row comes back into my matrix !!
I give you a snippet of my code (function getSelectedRow gives the selected row in the matrix):
==
if (evnt.ItemUID.Equals(ViewConstants.Items.DELETEBUTTON))
if (evnt.EventType == BoEventTypes.et_ITEM_PRESSED)
if (evnt.BeforeAction)
form = BusinessOne.Application.Forms.Item(formUID);
mtx = (Matrix)form.Items.Item(ViewConstants.Items.MATRIX).Specific;
int numRow = getSelectedRow(mtx);
if (numRow != -1)
mtx.DeleteRow(numRow);
form.Mode = BoFormMode.fm_UPDATE_MODE;
Item btn = (Item)form.Items.Item(ViewConstants.Items.ADDBUTTON);
btn.Enabled = true;
==
Cheers,
Marcel Peek
Alpha One
Message was edited by: Marcel Peek
Message was edited by: Marcel PeekYes, there is a problem to delete the last row.
It is fixed in version 2005. -
I have upgrade to IOS 8 and all Fotos are ereased on my Iphone and on my Computer is only the last Backup and there a no Photos now what can i do?
You really need to try this on a computer, not on the iPad.
Seeing how what is in the cloud is also on the iPad, if the content is not on the iPad, there is a good chance that the content is lost. But you can try logging into www.icloud.com in a web browser on a computer and log into your account and see if you can get into the Pages app. You may have to sign up for iCloud drive if you didn't do so already. Make SURE you that you read the blurb that will pop up in that window in iCloud for more information. -
To find out the last row that is updated in a View Object
Hi OAF Gurus,
I have requirement like,
I have to find out the last row that is updated on a particular View Object and I have send a mail to the users about the change.
JegSAMassMobVOImpl vo = getJegSAMassMobVO1();
JegSAMassMobVO is the View Object Name and it displays certain rows that has already been added to the VO in the Page.
Now the issue is when a user updates a particular row,I have to find which row gets updated and have to send a email to that particular employee about the change.
Just want to know,how to find out the last updated row in a particular VO.
Any Help would be appreciated as this a immediate requirement.
Regards,
Magesh.M.K.
Edited by: user1393742 on May 4, 2011 1:06 AMHi Magesh
It shoud be a Advanced table ,so when user will update the row ,the specific row will fire the PPR and on that event u can capture the row using row reference ,this is the sample code below
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean); OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.
262
am.invokeMethod("<handleSomeEvent>", parameters);
In your application module's "handler" method, add the following code to access the source row:
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
Thanks
Pratap
Maybe you are looking for
-
Inspection lot is not getting updated in quant
Hi Experts, Need your help.. I have posted two material doc with same material following is the consequences : 1.we have immediate TO creation process , so now we have 2 TO's and 2 inspection lots. 2.When i am doing UD for first inspection lot PCN do
-
FIREFOX IS FREEZING MY BACKGROUND GIF IMAGES WHEN THEY USED TO RUN SMOOTHLY BEFORE.
WE CREATE WEBSITES USING THE WEEBLY CREATOR, AND ALL OF OUR BACKGROUND IMAGING WORKS FLAWLESSLY IN CHROME. BUT WE DESIGN ALL OF OUR WEBSITES USING THE FIREFOX BROWSER, AND CERTAIN BACKGROUNDS ARE FREEZING WHEN THEY NEVER USED TO DO SO BEFORE. 1. WE D
-
Adobe Help required:subtotal of amount per page in Adobe forms
Hello everyone, I have the following requirement: If i have 12 items in my i_item table: Page 1 --> 8 items fit calculate and display subtotal of field amount(WRBTR) of the 8 items at end of page 1 Page 2 --> remaining 4items fit
-
Memory Out of Exception error.
Post Author: rajeshr CA Forum: Exporting Hi, We are trying to merge a crystal report with an xml file. And at certain time we receive the following error. Tis problem is intermittent. It would be great if someone who could help us resolve this probl
-
How to pass internal table from FM to mai report
Hi, I have created a new FM and under this all mine data is coming in one internal table IT_OUTPUT. now how to take this internl table to main report along with whole data.