Get Last Row Excel VI
Hello Everyone
I came across the VI attached on
https://decibel.ni.com/content/docs/DOC-22422
(Below is my modified LV 2010 version but it is not much different)
I understand that you are able to put in numerical data but in a single row I want to be able to have numerical data, words, and a URL.
I think you have to use the Append Image to Report for the URL part but does anyone understand why it has to be 2D array if I just want the
last row to put in all my data. I do not know where or how I can add just words to this last row or the image.
Any help is appreciated.
xxxMidna19
Attachments:
Write%20Row%20of%20Data%20to%20Excel%20Spreadsheet%202010[1].vi 19 KB
There are two questions, so here are two answers.
Question 1 -- how do you mix numbers, strings, and URLs? Answer -- convert everything to strings (which, I believe, is what happens internally -- indeed, the input is labelled Text Data).
Question 2 -- why do you need to pass in a 2-D array if you are only writing a single row? Answer -- the "generic case" is to write an entire table, i.e. rows and columns, or a 2-D array, all at once. As a "special case", you can accept a single row if you convert it to a 2-D array (1 row, many columns) simply by passing it through a Build Array block. Thus you can have a single function Append Text Table to Report handle both multi-line text tables and single-line (faked to appear as though it were multi-line) text tables.
Similar Messages
-
How to get last row and sum of all columns in one query
Hi ,
is there a way to get last record for a column and sum of all record for another column in the same query.
Best Regards ,You should define your requirements properly for volunteers to help here..
Your data is not good enough to provide you accurate solution. Reason being you dont have a proper column which differentiates between first and last entry.
The solution becomes easy based on your desgin.
I have introduced a grouping column called "id" and a time column called "time_of_insert" (only this way you can confidently say that you can differentiate between first and last (also a fool proof solution) --- you may optionally use sequence(instead of date though if you say you may end up inserting two rows at the same time, then probably sequence would be a better choice to differentiate rather than a timestamp field) etc...)
With your sample data something like this can be done to achieve your desired result.
WITH dataset AS
(SELECT 1 id,10 used, 8 remain,systimestamp+1/24 time_of_insert FROM DUAL
UNION ALL
SELECT 1 id, 1, 7,systimestamp+2/24 FROM DUAL
UNION ALL
SELECT 1 id,2, 5,systimestamp+3/24 FROM DUAL
UNION ALL
SELECT 1 id,1, 0,systimestamp+4/24 FROM DUAL
UNION ALL
SELECT 1 id,0, 0,systimestamp+5/24 FROM DUAL
UNION ALL
SELECT 1 id,1, 4,systimestamp+6/24 FROM DUAL)
SELECT *
FROM (SELECT SUM (used) OVER () sum_all,
FIRST_VALUE (remain)
OVER (PARTITION BY id ORDER BY time_of_insert DESC)
last_row
FROM dataset)
WHERE ROWNUM = 1;
Output:
SUM_ALL LAST_ROW
15 4
Cheers,
Manik. -
Hello,
I'm not very expierenced in ABAP Web Dynpro so please excuse me if this question is kinda easy to solve for you guys
I've got a table which displays the different items that are in a PO (via node). Now I need a way to select the LAST ROW from that table.
Thxhi ,
u need to proceed as follow :
1 go to code wizard , press CONTROL + F7
2 click on the radio button read context node/attribute
3 read the context node which is binded to ur table UI element
DATA lo_nd_cn_table TYPE REF TO if_wd_context_node.
DATA lo_el_cn_table TYPE REF TO if_wd_context_element.
DATA ls_cn_table TYPE wd_this->element_cn_table.
DATA itab TYPE wd_this->elements_cn_table.
* navigate from <CONTEXT> to <CN_TABLE> via lead selection
lo_nd_cn_table = wd_context->get_child_node( name = wd_this->wdctx_cn_table ).
4 after u have taken the node reference thn u can take the values in a internal table using
get_static_attributes_table method
lo_nd_cn_table ->get_static_attributes_table( IMPORTING table = itab ).
5 u can also get the work area value of the selected row of ur table , like this :
* get element via lead selection
lo_el_cn_table = lo_nd_cn_table->get_element( ).
* get all declared attributes
lo_el_cn_table->get_static_attributes(
IMPORTING
static_attributes = ls_cn_table ).
6 for ur specific case , u need to get the values of the last row ,
u can do it thru DESCRIBE abap statement
DATA : lv_index
DESCRIBE TABLE itab LINES lv_index.
7 now as lv_index contains the last row index , u can simple use
READ TABLE itab into wa INDEX lv.
It wud serve the purpose
rgds,
amit -
How get pervious row value in grid
hi master
sir
I have grid in my form my user design the balance sheet
Then he want add the last row value in next row
Such as
Row2 amount=1000
Row3 row2+2000
Total row3-row2
How I get last row value
Please give me ideaOther solution is to use a collection in a package unit.
Type TYP_COLL is table of Number INDEX BY BINARY_INTEGER ;
my_coll TYP_COLL ;
Then in the Post-Trigger :
my_coll( :system.current_record ) := value ;so you can navigate easily within the collection in both directions Next/Previous.
Easy to get the previous value:
value := my_coll( :system.current_record - 1 ) ;Francois -
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 -
Trying to get the last row from a resultset
Hi,
I'm trying to do a query to postgreSQL and have it return the last updated value, (last row).
My prepared statement is returning the correct results, but i'm having a problem getting the latest value.
I'm using a comboBox to drive a textfield, to load the last entered values in depending on which item in the comboBox is selected.
I've tried a variety of things and most seem to return the first row, not showing the updated values.
Or, if it does work, it takes to long to load, and i get an error.
here is the working code;
Object m = machCBX.getSelectedItem():
try { PreparedStatment last = conn.prepareStatement("SELECT part, count FROM production WHERE machine = ?",
ResultSet.TYPE_SCROLL_INSENSITIVE, //tried both INSENSITIVE and SENSITIVE
ResultSet.CONCUR_READ_ONLY);
last.setString(1, String.valueOf(m));
rs. = last.executeQuery();
if(rs.isAfterLast) == false ) {
rs.afterLast();
while(rs.previous()) {
String p = rs.getString("part");
int c = rs.getInt("count");
partJTX.setText(p);
countJTX.setText(c);
}this grabs values, but they are not the last entered values.
Now if i try to use rs.last() it returns the value i'm looking for but takes to long, and i get:
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space I also know using ra.last() isn't the best way to go.
I'm just wondering if there is another way other than getting into vectors and row count? or am i better off to go with the later?
thanks
-PDOK, you've got a major misunderstanding...
The relational database model is built on the storage of sets - UNORDERED sets. In other words, when you hand a database a SELECT statement without an ORDER BY clause, the database is free to return the results in any order.
Now it so happens that most databases will happen to return data retrieved by an unordered SELECT, at least for a while, in the same order that it was inserted, especially if no UPDATE or DELETE activity has occured, and no database maintenance has occured. However, eventually most tables have some operation that creates a "space" in the underlying storage, or causes a row to expand and have to be moved or extended, or something. Then the database will start returning unordered results in a different order. If you (or other people) never ever ever UPDATE or DELETE a table, then on some databases the data might well come out in insertion order for a very very long time; given human nature and the way projects tend to work, relying on that is a sucker's bet, IMHO.
In other words, if you want the "most recent" something, you need to store a timestamp with your data. (With some databases, you might be able to take advantage of some non-standard feature to get "last updates" or "row change timestamps", but I know of no such for Postgres.
While this won't solve your major problem, above, your issue with rs.last is probably occuring because Postgres by default will prefetch your entire ResultSet. Use Statement.setFetchSize() to change that (PreparedStatement inherits the method, of course). -
ALV grid to excel : last row datas are missing (Ecc6.0-GUI7.1)
Hello,
Some colums are empty in the last row by clicking into the excel icon???
Please note ,I must not use the print preview.
I have specified outputlen and datatype for the fieldcat but it doesn' t resolve the problem.
Thank you very much,
JcNavech.Hello,
any idea about how to sove this problem? I have it as well.
My ALV has 132 rows and 24 columns and when exporting to Excel last 19 coulmns of very last row are empty.
I don't think that Suggested Note 1429136 solve this problem because I have much less that 256 columns and 65536 rows.
Thank you!
Best regards
Guido
PS: I have ECC 6.0 - SAB BASIS SAPKB70014 and SAP GUI 7.10 -
VBS:How can i determine the last row of an excel-sheet
I want to replace the chn-comments of an datafile. I pick up the chn-names and want to compare them with an excel-file and so get from the excel-file the right chn-comment and store int back in the datafile. my problem is how can i determine where the excelfile-row is on the end to load the loopounter with corr values.
i know one solution via scan on ascii 13 and 9.but bether is to know immediately the length of the column.
answers also in german possible.Peter,
Are you using DIAdem's Excel Import Wizard? By "Excel file" do you mean a tab- or comma-delimited ASCII file that Excel can read in easily, or do you mean a file with the extension "*.xls"? You certainly could not search through an *.xls file to find CR/LF characters.
If you use the ASCII or Excel Import Wizard to create an *.STP file for the "Excel" file in question, then after the *.STP file is loaded you have access to a whole range of variables, starting with Ascii... or Excel... which completely outline the structure of the ASCII or Excel file, including things like the row in which the channel comments are, etc.
Why don't you send over your Excel file and I'll be able to help you a lot better.
Regards,
Brad Turpin
NI -
Getting last x rows written to the DB
Hi all
I have written some data to my table and wanted to know the best way of getting the last x rows written to the table?
Thanks for any suggestions.Probably I come a little late here, but here is my suggestion:
WITH data AS (SELECT SYSDATE + 1 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 2 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 6 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 1 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 4 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 5 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 6 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 2 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 1 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 3 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 1 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 3 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 1 / 24 AS col1
FROM DUAL
UNION ALL
SELECT SYSDATE + 6 / 24 AS col1
FROM DUAL)
SELECT *
FROM (SELECT col1,
DENSE_RANK () OVER (ORDER BY col1 DESC) AS rnk
FROM data)
WHERE rnk = 1
/So, if you have some sort of data and a column of datetime type, you can sort the data in descending order by this datetime column and then take the "last" rows, e.g. the rows which value in the datetime column is the oldest one. -
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. -
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 write a query to get the total as a last row
Hi,
I need to get something like this ....
|TEAM LEADER| TEAM | OCT TRN | EMPS| YTD% |
|_____________|__________|__________|______|_______|
| JOHN | JD Team | 12 | 12 | 100 |
|_____________|__________|__________|______|_______|
| Total | | 12 | 12 | 100 |
|_____________|__________|__________|______|_______|
I have to get the last row as total adding the number columns ...
Thanks in advance ...Take a look at the GROUP BY ROLLUP feature:
create table t1
(team_name varchar2(30)
,wins number
,losses number
insert into t1 values ('Hornets',3,1);
insert into t1 values ('Panthers',4,0);
insert into t1 values ('Wolves',2,2);
insert into t1 values ('Badgers',0,4);
insert into t1 values ('Hornets',1,3);
commit;
select decode(team_name,
NULL,'TOTAL',
team_name) team_name, sum(wins), sum(losses)
from t1
group by rollup(team_name);
TEAM_NAME SUM(WINS) SUM(LOSSES)
Badgers 0 4
Hornets 4 4
Panthers 4 0
Wolves 2 2
TOTAL 10 10 -
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! -
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 create a new row on tab out of the last column, last row?
JDev 11.1.2.1.0.
I've seen a few topics on this but none that I think were really very good solutions.
Use Case:
On tab out of the last column in the last row, a new row should be added to the end of the table. Bonus points for setting the focus to the first <af:inputText> of the newly created row.
Complications:
1. I'm having a heck of a time trying to find a function that returns the column's displayed index. Sadly, <column binding>.getDisplayIndex() returns -1 unless the user has manually re-ordered the column.
2. Value Change Listeners only fire if there is a value change. Guess that means I need to do client/server listeners to check each and every <af:inputText> for a tab press?
3. I'm not even going to get into setting the focus. With all the templates, regions, etc. going on, it's dang near impossible.
Any ideas on how to attack this one?
WillHi,
You will need to use the Run Engine Installation Wizard found on the Tools menu. In addition you need to create a installation set for the operator interface.
Look at Chapter 16 Distrubuting TestStand ( chapter 17 for version 2).
Once you have created your installation, install is on your new system.
The serial number etc is part of the process model. When you run the entry point 'Test UUTs' the PreUUT callback is executed which asks the user for the serial number.
Hope this helps
Ray Farmer
Regards
Ray Farmer
Maybe you are looking for
-
Reminders wont sync with my outlook tasks etc.
have updated both my ipad2 and iphone 4 to the new operating system, and was expecting reminders to work as mail and calanders have. have is set up some thing incorrectly?
-
JMS Adapter: Sending data with WebSphere MQ Client to XI
Hi, I want to send data from the WebSphere MQ Client to the XI. Is this possible and what do I have to do except configuring the JMS queues in Visual admin? Thanks in advance Dominic
-
How/where do you configure the printers on a machine to indicate that they do or don't support a particular DocFlavor?- so that an application can restrict the printers that can be chosen to those that are appropriate to the job. I guess the answer w
-
WRT54G Can ping to outside world but can't browse internet.
I have a WRT54G wireless router. The wireless is working fine as I can communicate with the router admin area via a web browser. I can also send and receive packets by pinging a site - like www.google.com. The router is connected to a cable modem. If
-
E71: List of non-working Bluetooth devices - & the...
For those of you unlucky enough to be struggling with the E71's buggy Bluetooth (see /discussions/board/message?board.id=connectivity&thread.id=18316), I thought it might be helpful to compile a list of Bluetooth devices that the E71 can and can't g