Extracting an index of the last row in a spreadshee​t file.
Hi,
Here is a brief description of my program.
I'm checking if an xls file me already exists.. if not, then I created it.. if it does, then I'm opening it and I want to add additional rows to it.. I'm looking for a way to extract the indexof last row.. I tried using ReadFromSpreadheetFile.vi but failed toextract last row.. I dont want to use activeX and yes I did try searching the forum.
Any suggestions?
thanks
Not sure if this is what you are trying to acheive!
Beginner? Try LabVIEW Basics
Sharing bits of code? Try Snippets or LAVA Code Capture Tool
Have you tried Quick Drop?, Visit QD Community.
Similar Messages
-
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 -
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 -
How to Finding the Last Row Value in Datagrid?
Hi Everyone,
Thanks in Advance.
I need your help, to find the last row data in Datagrid.
Actually i am using Datagrid to display my Data in flex. In my data i stored the gender value of employees. So if the last row in my datagrid is "female" i need to be highlight that particular row. So please help me to solve this issue.
Thanks,
Charles. Jdatagrid.selectedIndex = datagrid.dataprovider.length;
^ something like this will select the last row in the datagrid.
if you need to check it's value, you might need to cast an object here, based on the index value, and check it's gender value.
datagrid.selectedIndex = datagrid.dataprovider.length;
if (datagrid.selectedItem["gender"] == "female") {
//handle here -
Cant get the last row in jtable
Hello all.
I am trying to get the last row from the table but get "" from it.
my table has 6 rows and i can get all rows right but the last line I have a problem.
//creating the table
for (i=0;i<this.rows;i++)
model.insertRow(i,new Object[]{"input Y1:",""});
for ( i=i;i<this.Amount+this.rows;i++)
model.insertRow(i,new Object[]{"input Amount:",""});
//end of creatingthis code creats the table that i need and its works right.
for(i=0;i<rows;i++){
fObj.fullData[i] = Double.valueOf(GetData(table, 1, i).toString()).doubleValue();
int j=0;
String s=GetData(table, 1, 4).toString();
//the problem line
String s1=GetData(table, 1, 5).toString();
public Object GetData(JTable table, int col_index, int row_index){
return table.getModel().getValueAt(row_index, col_index);
}this line i get ""
String s1=GetData(table, 1, 5).toString();
Edited by: vitaly87 on 00:41 08/04/2011vitaly87 wrote:
Hello all.
I am trying to get the last row from the table but get "" from it.
my table has 6 rows and i can get all rows right but the last line I have a problem.
this line i get ""
String s1=GetData(table, 1, 5).toString();Looks right to me, given that your insert ismodel.insertRow(i,new Object[]{"input Amount:",""});(Hint: indexes start at *0* ).
If it hadn't found the row, I expect you would have got an Exception
Winston -
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! -
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. -
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 -
Needs help to retrive the last row in a select query without using rownum
Hi ,
i need to retrive the last row from the select sub query without using rownum.
is there any other way to retrive the last row other than the below query.
is that the ROWNUM=1 will always retrive the 1 row of the select query ?
select from*
*(select ename from employee where dept_id=5 order by desc) where rownum=1;*
Please advise.
thanks for your help advance,
regards,
Senthur957595 wrote:
Actually my problem is ithat while selecting the parents hiearchy of the child data using
CONNECT BY PRIOIR query
I need the immediate parent of my child data.
For example my connect BY query returns
AAA --- ROOT
BBB --PARENT -2
CCC --PARENT-1
DDD IS my input child to the connect by query
Immediate parent of my child data "DDD" ---> CCC(parent -1)
i want the data "CCC" from the select query,for that i am taking the last row of the query with rownum.
I got to hear that using ROWNUM to retrive the data will leads to some problem.It is a like a magic number.I am not sure what the problem will be.
So confusing with using this rownum in my query.
Please advice!!!It's not quite clear what you're wanting, but perhaps this may help?
you can select the PRIOR values to get the parent details if you want...
SQL> ed
Wrote file afiedt.buf
1 select empno, lpad(' ',(level-1)*2,' ')||ename as ename, prior empno as mgr
2 from emp
3 connect by mgr = prior empno
4* start with mgr is null
SQL> /
EMPNO ENAME MGR
7839 KING
7566 JONES 7839
7788 SCOTT 7566
7876 ADAMS 7788
7902 FORD 7566
7369 SMITH 7902
7698 BLAKE 7839
7499 ALLEN 7698
7521 WARD 7698
7654 MARTIN 7698
7844 TURNER 7698
7900 JAMES 7698
7782 CLARK 7839
7934 MILLER 7782
14 rows selected.(ok, not the best of examples as the mgr is already known for a row, but it demonstrates you can select prior data) -
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 -
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 advanceVJ 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. -
How to display the last row in a table
I have a table that is constantly updating, and I always want to see the last row. How can I get my table to auto scroll?
Hi žabić,
there is a property called "top left visible row". You can use it to scroll your table.
edit:
Maybe this is not the exact name, but you can see an example here
Mike
Message Edited by MikeS81 on 05-27-2010 03:57 PM -
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.
-
Insert a button on the last row of a report
Hi all,
my client wants an "add" button on the last row of any report that he has. I can do it easy on the first row (SELECT DECODE(rownum,1,'button','')), but I couldn't find a solution for this situation.
Can anyone help me?
Thanks in advance.
Nelson FreitasSorry, but I didn't quite understand the answer. Here's my example, a real one :)
select "SGP_DIS_ENT_ANO"."SCE_ID" as " ",
"SGP_ANO_ESC"."SAE_ANO" as "Ano",
"SGP_CUR"."SCU_DES" as "Curso",
"SGP_DIS"."SDE_DES" as "Disciplina"
from "SGP_ANO_ESC" "SGP_ANO_ESC",
"SGP_EST_ANO" "SGP_EST_ANO",
"SGP_CUR" "SGP_CUR",
"SGP_DIS" "SGP_DIS",
"SGP_DIS_CUR" "SGP_DIS_CUR",
"SGP_DIS_ENT_ANO" "SGP_DIS_ENT_ANO"
where "SGP_DIS_ENT_ANO"."SDC_ID"="SGP_DIS_CUR"."SDC_ID"
and "SGP_DIS_CUR"."SDE_ID"="SGP_DIS"."SDE_ID"
and "SGP_DIS_CUR"."SCU_ID"="SGP_CUR"."SCU_ID"
and "SGP_DIS_ENT_ANO"."SEA_ID"="SGP_EST_ANO"."SEA_ID"
and "SGP_EST_ANO"."SAE_ID"="SGP_ANO_ESC"."SAE_ID"
and "SGP_DIS_ENT_ANO"."SEN_ID" = :P19_SEN_ID
Could you help me with it?
Thanks
Maybe you are looking for
-
Change physical size of a PDF?
I have a PDF 11" wide x 8.5" tall. That is the trim size and I need it changed to 11.25" x 8.75" to include the bleed. Is there a way to adjust the PDF? There are images on the current PDF that bleed off the page. Thanks in advance. Message was edit
-
Using ${something} expressions in jsp
hello, i'm writing a small web application using struts, hibernate, tomcat, my problem is that expressions ${some_formbean_property} written in jsp stay in html code to, they should be replaced with value of the property, what i have to do to fix it?
-
OLAP variable for data selection
hi all , can any own explain how the OLAP variable is used for data selection in the info package. how the value is changing in the Variable. thanks in advance rajan
-
How to let clients update site
I am using Dreamweaver MX (v6.0) and am self-taught and only use basic html. I would like to update my existing sites as well as create new sites that enable the client to update certain areas themselves. Please reccommend an application/programme th
-
Process for Annual Reports / Page Updates Etc....
Whats the best way to get the text in a document that is 20+ pages with text and images, like an annual report? Should I link the whole WORD file? Make a WORD file for each page? I want my client to be able to easily make text changes and resend a wo