Sorting table 2D with header?
I'm not trying to apply anything in particular. I'm just wondering what would be the best aproach to solve this problem, if I asked.
If I have a table 2D of strings with columns that contain text, others that contain numbers or timestamps, and the first line is the header, how I would go about how to sort on a particular column? The results did not come from a query of database so not "order by".
I thought to use ActiveX calls to Excel. Another possibility is to use a temporary table of SQLite. How would you do that?
SteveChandler wrote:
I thought to use ActiveX calls to Excel. Another possibility is to use a temporary table of SQLite. How would you do that?
In LabVIEW, of course!
Here's what I'd do:
(1) remove the header line, leaving a table 2D-data channels
(2) extract the desired sort column. In a loop for, browse the table 1 d resulting from chains. Convert each string the appropriate representation and together with the number of iterations, so the output is an array of a cluster of two elements.
(3) using 1-d matrix sort to sort the array of clusters.
(4) browse the sorted table. Unbundle the meter element, take this rank on the original 2D array and add it to a new table.
(5) Insert the header row in the sorted table.
Tags: NI Software
Similar Questions
-
Sort Table data with text fields (form)
I googled and searched forms of days for a response, but were unsuccessful.
The only wire that I found being a year old, I wanted to start a new instead of bumping an old
Ref:
I'm looking for a script to sort the data in a form that is based on user input.
The shape is just a table with multiple rows and columns of 3-5 (according to the dept) it's used)
Using the thread referenced above, I was able to get a static table to sort, but I need to have all the fields to be text fields and the users enters the data.
The example of the other thread static:
I'll use the same layout, just need to be a shape rather than static.
If anyone can help or point me in the right direction, it would be great.
Update #1:
I find this page:http://cookbooks.adobe.com/post_Sorting_tables_in_dynamic_PDF-18993.html
I'm the kind of work and it seems to be mostly what I look for, but how to deal with field empty?
For example, the last three lines are empty (no data) the genre fails.
Here is the code of the page, how can I change to fix the empty fields?
------------------------------------------------
pass var = 0; column index
var num = false; Is the numeric column
var OrderAsc = true; Sort order
function SortTable (tableRef, colIndex, isNumeric, CSA)
{
Try
{
Col = colIndex;
NUM = isNumeric;
OrderAsc = Asc;
String variable that contains the data of the form as the XML string
data var = tableRef.saveXML ('pretty');
A XML variable contains the deserialized XML data
xmlData var = xfa.datasets.createNode ("dataGroup", tableRef.name);
xmlData.loadXML (data);
Number of rows in the table
var rowsCount = xmlData.nodes.length;
Number of columns in the table
passes of the var = xmlData.nodes.item (1).nodes.length;
Two dimension table contains data of the complete table
Master of var = new Array();
Fill in the chart with XML data
for (var i = 1; i < rowsCount; i ++)
{
Master [i-1] = new Array();
for (var j = 0; j < passes; j ++)
{
Master [i-1] [j] = xmlData.nodes.item (i).nodes.item (j) .value;
}
}
Sort the table 2D
Master.sort (sortFunc);
Re-fill the XML variable with data in table
for (var i = 0; i < master.length; i ++)
{
for (var j = 0; j < master [i] .length; j ++)
{
xmlData.nodes.item(i+1).nodes.item (j) .value = master [i] [j];
}
}
Change the data in the table and the back of the form
var result = xmlData.saveXML ('pretty');
tableRef.loadXML (result, 1, 1);
XFA. Form.remerge ();
} catch (e)
{
App.Alert (e)
}
}
Customize the sort function to manage the 2D array and numeric columns
function sortFunc (a, b)
{
var x = a [col];
var y = b [col];
Try
{
If (num)
{
x = parseInt (a [col]);
y = parseInt (b [col]);
}
} catch (e) {}
If (OrderAsc)
{
return x == y? 0: (x < y?-1: 1)
}
on the other
{
return x == y? 0: (x < y?-1: 1)
}
}
Solution found!
-
How to create dynamically sorting table?
For example, I have a table with 2 columns: 'Name', 'value x; and 1 table with columns 'name' value 'y' (which is based on the value of x + a formula). What I want to achieve is to get table2 sorted whenever I change value in table1. The "Filter/Sort" tool only applies sort once and doesn't react to any changes made to the table 1.
I don't know how the practice is (I find it easier at the station just manually), but here's a way to generate an array sorted automatically.
Add a column "index" for the value of Y in the same table (this can be hidden if you want) with a formula like this:
The formula in C2, filled to the bottom:
= B2 + 5 + LINE () / 10000
The idea is to calculate Y using some formula that you use and then add a very small number based on the number of line so that it becomes a unique value that can be used for searches, even when the same value 'original' appears more than once.
Then in column B of the table "Sorted" list the values for Y in Crescent order like this:
The formula in B2, filled to the bottom:
= SMALL (Table 1: $C, ROW (−1))
And, finally, to get the name corresponding to this value of Y as this:
The formula in A2, filled to the bottom:
= INDEX (table 1: $A, MATCH (B2, table 1: $C, 0))
Now, whenever you change a value in the column X, "Sorted" table is automatically sorts.
SG
-
[OBIEE 11 g] Create customized to group columns in a table view column header
Hello world
I got a requirement to group certain columns in the table view with a custom column header name (for example to create a two-level header).
The layout I have now:
[Jan] [February] [Mar] [Apr] [May] [June] [Jul] [August] [Total sales]
-----------------------------------------------------------------------------------------------------------------------
1 2 3 4 5 6 7 8 36
The layout I want to achieve:
[ Q1 ] [ Q2 ]
[Jan] [February] [Mar] [Apr] [May] [June] [Jul] [August] [Total sales]
-----------------------------------------------------------------------------------------------------------------------
1 2 3 4 5 6 7 8 36
I use Table View, is it possible to get the above provision? Any comments appreciated. Thank you.
See you soon,.
Kayip
Hello
It is a simple parameter, it is unpacking already...
The property "of the topic folder" of your columns allows you to enter the required text.
PS: Do you really have columns in your field with the name of the month? Is it not something better managed with a hierarchy of real time and using a pivot to display the month columns? In this case the grouping of quarters is already there...
-
PivotTable with header in two rows
Hello
is it possible to split a large pivot table to the narrower PivotTable with two heads?
I need to achieve this result: [http://img30.imageshack.us/img30/2339/oraclebipivotmultiplehe.jpg]
Column with total didn't need to be formatted as it is on the screenshot. But for me it is important to split a long pivot table two rows header...
Thank youI have the solution. I have transformed an original table with clean function js and jQuery
function transformPivotTable (tableId) {}
var $tables = $("#" + tableId + "table.) Pivot table");
If ($tables.length == 1 & $tables.attr("id").substr (0.3) == 'vu') {}
var $table = $tables;
var $headings1 = $table.find ("tr:eq (0) td:lt (11)");
var $headings2 = $table.find ("tr:eq (0) td:gt (10)");
var $values1 = $table.find ("tr:eq (1) td:lt (11)");
var $values2 = $table.find ("tr:eq (1) td:gt (10)");
$table.find ("tr:eq (0)") .html ($headings1);
$table.find ("tr:eq (1)") .html ($values1);
var $newrowHeadings = $(')") .addClass ("PTRowLabelsRow");
var $newrowValues = $(')");
$newrowHeadings.html ($headings2);
$newrowValues.html ($values2);
$table.append ($newrowHeadings);
$table.append ($newrowValues);
}
}This function can be performed by button or after the page loads:
transformPivotTable('d\\:dashboard\\~p\\:0fbi1pfhhtepur3d\\~s\\:vpjrrqes9j4sbo2kContents');
' d\\:dashboard\\ ~ p\\:0fbi1pfhhtepur3d\\ ~ s\\:vpjrrqes9j4sbo2kContents' is ID to lock up the HTML table with escape characters. It was the final table with ID fixed. Other nested tables had dynamic IDs, so I had to go with fixed ID and my PivotTable to search for the attribute class.
-
BUG: 1 D table sort isn't sorting table of Classes and table Clusters contain Classes
the function "sort the table 1 d.
I wanted to sort the array of Clusters [number and class]. But to my surprise, LV is not like him.
Okay, I need sort table Classes. But maybe once in the future I will. :-)
'Research in table 1 d' is the use of classes I do not understand why 'sort the table 1 d' does not work.
This problem is in LabVIEW 8.2 and 8.5 2009
I think that the search feature of table 1 d can address each element in the table as an agregate whereas sort requires access to the private data in the data from the class and carrying it even further...
Say all the elements are in the Parent class and a tow children who both have private data that are uniqie each and not present in the class of parents...
How they manage breaking when there are different fields to sort on?
Ben
-
Hello
for my test application, I want to store test data in a text file with header. It should be like this:
name, series, count, current, min. Max run
Mister Smith
1234567890
111
10
1000
data:
1 345 34
2 355 23
3 360 34
...
The first row are only on the lines of header information. ' data: ' is the beginning of the data marker. The data consists of a number, the average value of the current regulation time in s.
Now I write an array of strings in the file text, but if the length of the header of Exchange I overwrite the data. For example, the name is Mister John Smith.
In my program, I can create a new file with header and I cannot change the header later. In the routine of the measure, I put the data in the file.
How can I solve this?
Thank you
Schwede
Hallo Schwede,
Here is an example:
Carefule and do a few checks, at this time, it will reduce 'your comments' when it exceeds 512 bytes...
-
Is it possible to load your phone with the Office using the cord with head phone the ends of both sides?
No, only USB.
Taken head phones don't have any power.
-
Tables compressed with more than 255 columns
Hello
Anyone for a sql to find tables compressed with more than 255 columns.
Thank you
Jonu
SELECT table_name,
County (column_name)
Of utc user_tab_columns
WHERE utc.table_name IN (SELECT table_name
From user_tables
Compression WHERE = "ENABLED")
HAVING Count(column_name) 255 >
GROUP BY table_name
-
Bulk collect into a Table nested with Extend
Hi all
I want to get all the columns of the table emp and dept. So I use bulk collect into the concept of nested table.
*) I wrote the function in three different ways. EX: 1 and 2 (DM_NESTTAB_BULKCOLLECT_1 & DM_NESTTAB_BULKCOLLECT_2) does not give the desired result.
*) It only gives the columns of the EMP table. That means it takes DEPT & columns of the EMP table, but it only gives columns of table EMP.
) I think, there is something problem with nested table Extend.
) I want to know infested.
Can we use bulk collect into a table nested with extend?
If it is yes then fix the below codes (EX: 1 & EX: 2) and can you explain me please?
Codes are given below *.
CREATE OR REPLACE TYPE NEST_TAB IS TABLE OF THE VARCHAR2 (1000);
EX: 1:
----
-Bulk collect into a Table nested with Extend-
CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_1
RETURN NEST_TAB
AS
l_nesttab NEST_TAB: = NEST_TAB();
BEGIN
FOR tab_rec IN (SELECT table_name
From user_tables
WHERE table_name IN ('EMP', 'Department')) LOOP
l_nesttab.extend;
SELECT column_name
bulk collect INTO l_nesttab
Of user_tab_columns
WHERE table_name = tab_rec.table_name
ORDER BY column_id;
END LOOP;
RETURN l_nesttab;
EXCEPTION
WHILE OTHERS THEN
LIFT;
END DM_NESTTAB_BULKCOLLECT_1;
SELECT *.
TABLE (DM_NESTTAB_BULKCOLLECT_1);
OUTPUT:
-------
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
* Only the EMP table columns are there in the nested table.
-----------------------------------------------------------------------------------------------------
EX: 2:
-----
-Bulk collect in the nested with Extend based on County - Table
CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_2
RETURN NEST_TAB
AS
l_nesttab NEST_TAB: = NEST_TAB();
v_col_cnt NUMBER;
BEGIN
FOR tab_rec IN (SELECT table_name
From user_tables
WHERE table_name IN ('EMP', 'Department')) LOOP
SELECT MAX (column_id)
IN v_col_cnt
Of user_tab_columns
WHERE table_name = tab_rec.table_name;
l_nesttab. Extend (v_col_cnt);
SELECT column_name
bulk collect INTO l_nesttab
Of user_tab_columns
WHERE table_name = tab_rec.table_name
ORDER BY column_id;
END LOOP;
RETURN l_nesttab;
EXCEPTION
WHILE OTHERS THEN
LIFT;
END DM_NESTTAB_BULKCOLLECT_2;
SELECT *.
TABLE (DM_NESTTAB_BULKCOLLECT_2);
OUTPUT:
-------
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
* Only the EMP table columns are there in the nested table.
-------------------------------------------------------------------------------------------
EX: 3:
-----
-Collect in bulk in a nested Table to expand aid for loop.
CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_3
RETURN NEST_TAB
AS
l_nesttab NEST_TAB: = NEST_TAB();
TYPE local_nest_tab
THE VARCHAR2 ARRAY (1000);
l_localnesttab LOCAL_NEST_TAB: = LOCAL_NEST_TAB();
NUMBER x: = 1;
BEGIN
FOR tab_rec IN (SELECT table_name
From user_tables
WHERE table_name IN ('EMP', 'Department')) LOOP
SELECT column_name
bulk collect INTO l_localnesttab
Of user_tab_columns
WHERE table_name = tab_rec.table_name
ORDER BY column_id;
BECAUSE me IN 1.l_localnesttab. COUNTING LOOP
l_nesttab.extend;
L_NESTTAB (x): = L_LOCALNESTTAB (i);
x: = x + 1;
END LOOP;
END LOOP;
RETURN l_nesttab;
EXCEPTION
WHILE OTHERS THEN
LIFT;
END DM_NESTTAB_BULKCOLLECT_3;
SELECT *.
TABLE (DM_NESTTAB_BULKCOLLECT_3);
OUTPUT:
------
DEPTNO
DNAME
LOC
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
* Now, I got the desired result set. DEP. and columns of the Emp Table are in the nested Table.
Thank you
AnnCOLLECTION BULK cannot add values to an existing collection. It can only crush.
-
Copy a few lines in the same table, but with different IDS
Hi all
I had this problem... I have a table with its pk (which is a sequence). With a statement select, I extract a few lines, and then I would record in the same table, but with IDS different (obviously eheheh).
I don't know how to do...
Thks for all help ;)
p.s. I want to change some fields in lines before saving as well... don't know how do it more...
example:
ID NAME TYPE
1 ferrari car
2 cars lamborghini
I'm trying to copy the second and changing its type in "BMW".
I could result:
1 ferrari car
2 cars lamborghini
3 bmw cars
Thank youAssuming that your table is named cars_tb and the cars_seq of the sequence.
insert into cars_tb select cars_seq.nextval, name, type from cars_tb
This would overlap with any existing lines, but with a new id.
If you want to duplicate a specific line and change a value, you could do something like:
insert into cars_tb select cars_seq.nextval, name, 'BMW' from cars_tb where type = 'lamborghini'
or better, use the PK
insert into cars_tb select cars_seq.nextval, name, 'BMW' from cars_tb where id = 2
-
What controls the space above "maincontent" in CSS layout with header?
In a page layout CSS freshly downloaded with header (twoColHybLtHdr or similar), there is a space of subject 20px from the bottom of the header area to the top of the box maincontent. For this reason of space, when a bottom border is added to the header and a left edging maincontent, two lines don't intersect, which is what I want. What controls this space so I can get rid of him?
Thank you, Joann
Hi Joann,
Add this to your CSS and it will consolidate the gaps for you.
/ * put the parameters of the default browser on all zero * /.
* {margin: 0; padding: 0; line-height: 100%; do-size: 100 %}}
Then manually add some top of the margin, margin-bottom, padding and line-height to your different selectors: h1, h2, h3, p, ul, ol, li, li, etc...
Good luck
Nancy O.
ALT-Web Design & Publishing
Web | Graphics | Print | Media specialists
http://ALT-Web.com/
http://Twitter.com/ALTWEB
http://ALT-Web.blogspot.com -
Sorting table with custom function
Hello
I use JDev 11.1.1.4.0
I have a table with records.
Public Record (int id, String desc) {}
This.ID = id;
This.Description = desc;
}
I want to implement a sort function, the description column, based on the length of the string.
No idea how to do it?Hi Pedro,
In this case, the class registration should be 'comparable' as you say.
You can replace the current collection with an ordered list/set and then to implement the comparator interface.
This is an example:public java.util.TreeSet
getRecords() { TreeSet records = new TreeSet (new RecordComparator()); // routine to get the records return records; } ... class RecordComparator implements Comparator { @Override public int compare(Record o1, Record o2) { // be careful with null records/attributes! return o1.getDescription().length() > o2.getDescription().length() ? 1 : o1.getDescription().length() < o2.getDescription().length() ? -1 : 0; } } After that, try this:
http://technology.AMIS.nl/2012/03/01/ADF-11g-Programmatically-Configuring-sort-for-rich-table/AP
Correction:
Just add a transitional attribute to the Record class and try this with this new attribute: http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/AP
Published by: Alejandro Profet on November 12, 2012 15:32
-
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(); }
-
Count on a table with header and row data in the query
Hello
I have an obligation to prepare a report that shows the metrics on the provider. I need to find the total PO for this provider, which fit the Bill
report must be mealgne of #ofpo, #invoice, total_inv_amt and total_po_amt, total_tax_amt with numbers also with the point in time. So my question is how do we achieve this I have this below query that gives all the data but do not know how to get the counties with that. All ideas
SELECT hou.name,
POV. $VENDOR_NAME,
API.invoice_num,
API.invoice_id,
invoice_date,
gl_date,
API.invoice_currency_code,
APID.line_type_lookup_code inv_line_type,
APID. Description inv_description,
APID.amount,
APID.unit_price inv_price,
amount_paid,
apt. Name payment_terms,
payment_status_flag,
APC.check_number,
APC.check_date,
Poh.Segment1 po_num,
Poh.CREATION_DATE po_creation_date,
por. CREATION_DATE po_rel_creation_date,
por.release_num,
pol.line_num,
MC. Segment1 category_name,
(select item_num msi.segment1
MSI inv.mtl_system_items_b
where msi.inventory_item_id = pol.item_id
and msi.organization_id = 1) item_num.
pol.item_description po_item_description,
Poll.need_by_date,
pol.unit_price po_price,
Poll.Quantity,
Poll.quantity_cancelled,
Poll.quantity_received,
Poll.quantity_billed
OF api ap.ap_invoices_all,.
Hou hr_operating_units,.
apt, ap_terms_tl
AP.ap_invoice_distributions_all apid,
pod po.po_distributions_all,
Po.po_vendors pov,
Po.po_headers_all poh,
Po.po_lines_all pol,
survey of po.po_line_locations_all,
por po.po_releases_all,
AP.ap_checks_all apc,
AP.ap_invoice_payments_all IPA,
-inv.mtl_system_items_b msi,
Apps.mtl_categories_b mc
WHERE apt.term_id = api.terms_id
AND hou.organization_id = api.org_id
AND BETWEEN TRUNC (poh.creation_date): p_start_date AND: p_end_date
AND api.invoice_id = apid.invoice_id
AND apid.po_distribution_id = pod.po_distribution_id (+)
AND pov.vendor_id = api.vendor_id
AND poh.po_header_id (+) = pod.po_header_id
AND poll.line_location_id (+) = pod.line_location_id
AND pol.po_line_id (+) = pod.po_line_id
AND apip.check_id = apc.check_id (+)
AND apip.invoice_id (+) = api.invoice_id
AND mc.category_id (+) = pol.category_id
AND por.po_release_id (+) = pod.po_release_id
AND pov.vendor_id = 1Hello
Her looks like a job for the COUNT function. That's all I can say with certainty based on the information you gave.
If you want to see on each line of output, the number of rows with the same value of api.invoice_num has a value for poh.po_header_id, you can use
COUNT (poh.po_header_id) OVER (PARTITION BY api.invoice_num) AS po_cnt
I could give much better directions if you could post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data. I realize it's hard with so many pictures. To see some of your courses and the desired output, could help.
Maybe you are looking for
-
How to use my mac to remove photos of all my devices
I have an iMac, iPhone and the iPad. I transferred all the photos from my phone to my photo app on my iMac. How to remove photos simultaneously on all devices on my mac? If I enabled on iPhone and iPad photo app photos deleting photos stream removes
-
USB 2.0 should work on the Satellite 2410-303?
Recently, I have re-installed XP on my Satellite and think I have all the latest drivers installed now - including drivers from the chipset of this site. When I plug a USB device, I get a message saying that this device can run faster, so her acting
-
Japanese English Windows G20?
Hey, Chaps. I live in Tokyo and want to buy a Q20. The problem: they all come with Japanese software - I don't understand. Does anyone have experiences in installing a version of Windows English Japanese Qosmio G20? The Japanese version seems to have
-
When I try to play a song on mediaplayer it pause and when you press play there is no sound
original title: when I try to play a song mediaplayer it go to pause, but it works but no soundit didn't tell paused when I press play? I want to play music, but when I press on play stopand breaks but the cursor for the song Carry on, but he didn't
-
You can always buy Microsoft XP Professional product keys?
I don't want all the funny as '' Why? '' answers or "its obsolete". I just a Yes or no and a link to a place that sells them. PS do not try and sell me yours, I'm not interested.