Multiple column sorting.
How does one sort multiple columns( date, String, time etc...). I want to sort by date where two dates can be alike as well. I could use HashMap for that reason.
Please help.
Thanks in advance.
Hi,
A demo of the comparator class is given below. I've tried to put it into the table class.
import java.util.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.table.*;
import javax.swing.event.*;
class MultipleColumnSortTest
MultipleColumnSortTest()
JFrame frame = new JFrame("MultipleColumnSortTest");
frame.setBounds(10,10,750,550);
Vector fieldNames = new Vector();
fieldNames.add("Dates");
fieldNames.add("Strings");
Vector dataVector = new Vector();
for(int i = 0; i < 5; ++ i)
Vector row = new Vector();
row.add(new Date());
row.add("abc" + i%2);
dataVector.add(row);
final SortableDataVector tableModel = new SortableDataVector(dataVector,fieldNames);
int [] sortIndices = new int[2];
sortIndices [0] = 0 ;
sortIndices [1] = 1 ;
tableModel.setSortPriority(sortIndices);
JTable table = new JTable(tableModel);
JScrollPane scrollpane = new JScrollPane(table);
frame.getContentPane().add(scrollpane);
JButton button = new JButton("Sort Data");
frame.getContentPane().add(button,BorderLayout.SOUTH);
button.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent event)
tableModel.setAscendingOrder(!tableModel.isAscendingOrder());
tableModel.sort();
frame.setVisible(true);
public static void main(String [] args)
MultipleColumnSortTest appln = new MultipleColumnSortTest();
class SortableDataVector extends DefaultTableModel implements Comparator
private int [] indices;
private boolean isAscendingOrder;
public SortableDataVector(Vector dataVector, Vector fieldNames)
super(dataVector,fieldNames);
setAscendingOrder(true);
public void setAscendingOrder(boolean b)
isAscendingOrder = b;
public boolean isAscendingOrder()
return isAscendingOrder;
public void setSortPriority(int [] indices)
this.indices = indices;
public int compare(Object o1,Object o2)
int comparisonResult = compareAscending(o1,o2);
if(!isAscendingOrder)
if(comparisonResult < 0)
comparisonResult = 1;
else if (comparisonResult > 0)
comparisonResult = -1;
return comparisonResult;
private int compareAscending(Object o1, Object o2)
int comparisonResult = 0;
if((o1 == null)&&(o2 != null))
comparisonResult = -1;
else if((o1 != null)&&(o2 == null))
comparisonResult = 1;
else if((o1 != null)&&(o2 != null))
List firstRow = (List)o1;
List secondRow = (List)o2;
for(int i = 0; ((i < indices.length)&&(comparisonResult == 0)); ++i)
if(indices[i] < firstRow.size())
comparisonResult =
DatatypeSensitiveComparator.compare(
firstRow.get(indices),
secondRow.get(indices[i]));
return comparisonResult;
public boolean equals(Object obj)
if(obj == null)
return false;
return this.equals(obj);
public void sort()
if((indices != null)&&(indices.length > 0))
Collections.sort(dataVector,this);
fireTableChanged(new TableModelEvent(this));
class DatatypeSensitiveComparator
public static int compare(Object firstValue, Object secondValue)
int comparisonResult = 0;
if((firstValue != null)&&(secondValue == null))
comparisonResult = 1;
else if((firstValue == null)&&(secondValue != null))
comparisonResult = -1;
else if((firstValue != null)&&(secondValue != null))
Class clazz = firstValue.getClass();
if(!clazz.equals(secondValue.getClass()))
throw new IllegalArgumentException("Class are not the same ->"
+ clazz.getName() + ":" +
secondValue.getClass().getName());
if(clazz.equals(String.class))
comparisonResult = ((String)firstValue)
.compareTo(((String)secondValue));
else if(clazz.equals(Date.class))
comparisonResult = ((Date)firstValue)
.compareTo(((Date)secondValue));
return comparisonResult;
Similar Messages
-
Multiple Column sort Pop Up not opening using af:PanelCollection
Hi guys,
I have a table in which i want to sort on the basis of Multiple Columns.For that I have used af:PanelCollection but when in menus my advance sort Pop Up is Not opening.I am using jdeveloper 11.1.1.6.
<af:panelCollection id="pc1" styleClass="AFStretchWidth"
partialTriggers="t1">
<f:facet name="menus"/>
<f:facet name="toolbar"/>
<f:facet name="statusbar"/>
<af:table value="#{bindings.xx_sw_vwVO.collectionModel}"
var="row" rows="#{bindings.xx_sw_vwVO.rangeSize}"
emptyText="#{bindings.xx_sw_vwVO.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.xx_sw_vwVO.rangeSize}"
rowBandingInterval="0"
width="100%"
selectionListener="#{bindings.xx_sw_vwVO.collectionModel.makeCurrent}"
inlineStyle="height:350;"
rowSelection="single" id="t1"
partialTriggers="::cb1 ::sor1"
contentDelivery="immediate" immediate="true"
autoHeightRows="30" columnSelection="multiple">
<af:clientListener method="sskuRowSelection" type="click"/>
<af:serverListener type="sskuRowSelectEvent"
method="#{DataworkbenchBN.sskurowselect}"/>
<af:column sortProperty="SskuId" sortable="true"
headerText="#{bindings.xx_sw_vwVO.hints.SskuId.label}"
id="c33">
<af:inputText value="#{row.bindings.SskuId.inputValue}"
label="#{bindings.xx_sw_vwVO.hints.SskuId.label}"
required="#{bindings.xx_sw_vwVO.hints.SskuId.mandatory}"
columns="#{bindings.xx_sw_vwVO.hints.SskuId.displayWidth}"
maximumLength="#{bindings.xx_sw_vwVO.hints.SskuId.precision}"
shortDesc="#{bindings.xx_sw_vwVO.hints.SskuId.tooltip}"
id="it17">
<f:validator binding="#{row.bindings.SskuId.validator}"/>
</af:inputText>
</af:column>ADF -- panelCollection multiple column sort
~Abhijit -
Multiple column sorting in JTable
There is way to release multiple column sorting in JTable.
ADF/SWing, Jdev 10.1.3I do not know that there is, but it would be really nice!
regards,
mario udina -
Multiple column sorting on JTable data
if any body can please send an example code how multiple column sorting can be done on table data.
condition:- one column should sort in ascending order another column in descending order.
am completly out of ideas it's urgent any help is greatly appritiated
Thank's in advance
sriI think the crosspost is because the OP was advised to post it in the Swing forum instead (it would've been nice to see the original post closed as well, though). Anyway...
Have you got your table sorting using one column? If so, how have you achieved that (eg, are you using Java 6)?
All you're after is a stable sorting algorithm so that any elements that are the same in the new sorting scheme stay in the same position relative to each other. Then you can just sort by "Column B" then "Column A" to achieve multiple column sorting. I believe that Collections.sort is stable and therefore any sorting approach based on that should be easily modifiable to do what you want.
Hope this helps. -
Multiple Column Sorting in iTunes
I have seen many conversations around the edges of this, but no answers. I am curious if it is possible to configure a custom sort in iTunes involving multiple columns.
Here is what I would like to end up with - Artist; Sort Show (where I have stored the release date); Album; Disk Number; Track Number. Seeing my albums in chronological order is the way I always sorted physical albums, I would like to store my virtual ones the same way. iTunes allows me to use Album by Artist and then sort by Sort Show, but this then displays the tracks in alphabetic order by name!
Identifying multiple sort columns (as in Excel) would be ideal. Thanks for any help you can provide.
DaveIt is a database internally, and there are some multivalued sorts, but as users we don't get to specify custom sort orders. Album by Artist is more properly Album by Album Artist and in pseudo-SQL it would go something like this.
SELECT * FROM Selection ORDER BY SortAlbumArtist, SortAlbum, Disc# , Track#
Where there is no SortAlbumArtist it is inferred from the first non-empty value of AlbumArtist, SortArtist or Artist.
Where there is no SortAlbum it is inferred from Album.
The Disc# & Track# sorts place empties last.
Presumably the designers think they've included useful options and adding nested sorting features would be too complicated, but you can make suggestions via iTunes Feedback.
tt2 -
3.1 Multiple column sorts.
I have a report which I would like to have multiple columns that default in an ascending sort sequence order.
Example:
Column 1 will be sort sequence 2.
Column 2 will be sort sequence 3.
Column 3 will be sort sequence 1.
This was working in 3.0 and now the report only acknowledges the sort sequence of number 1.Did you ever get this working again? We'd like to implement something similar - allowing the user to pick a couple of different sort criteria options... How did you implement this in 3.0?
Thanks,
Yvette -
Comparator for multiple column sorting
Hi,
Wr have written a below query
select p.name, o.id, ol.name, pr.name from Person p , Order o , OrderLine ol, Product pr where...
order by p.key asc, o.key asc, ol.key desc, pr.key desc
This query is taking lot of time as it seems the ORDER BY is taking more time. Hence we thought of moving sorting in the java side.
Here whether I need to create 4 comparators
1) PersonComparator with p.key asc
2) OrderComparator with o.key asc
3) OrderLineComparator with ol.key desc
4) ProductComparator with pr.key desc
This query returns a list , hence we need to do some thing like this
Collections.sort(list, new PersonComparator())
Collections.sort(list, new OrderComparator())
Collections.sort(list, new OrderLineComparator())
Collections.sort(list, new ProductComparator())
Is there any other better way of handling this sorting as 2 fields needs asc and other 2 fields needs desc. Whether we need to create 4 comparators for each object?
Please clarify. If there is any alternative please specify that as well.
Thanks.>
This query is taking lot of time as it seems the ORDER BY is taking more time
>
Not sure how you drew that conclusion. There is nothing in your post to support it. Oracle is very efficient at sorting.
More likely the joins and filters (which you didn't show) in your query are either not using existing indexes or the proper indexes don't exist.
Post the question in the SQL and PL/SQL forum and provide the following information
1, Read the FAQ at the top of the main forum page for how to post tuning requests - it will include the below info
2. The 4 digit Oracle version (post results of SELECT * FROM V$VERSION)
3. The full query
4. The DDL for the Person, Order and OrderLine tables
5. The DDL for the existing indexes on the table
6. The approximate number of records in each table
7. The expected number of records you expect in the result set
8. The execution plan for the query
A. Open a sql*plus session
B. set serveroutput on
C. set autotrace traceonly
D. SELECT P.NAME ... -- that is, execute the query
E. Copy and Paste the entire output of the result, including the execution plan
You (or your DBA) need to determine how much work is being done and where the time is being taken before deciding what solutions to consider. The phrase 'taking more time' doesn't mean anything unless you have something to compare it to. Ten seconds to return one record could be slow while ten minutes to return 1 million records could be fast. -
Sorting multiple columns at a time
Hi All,
I have requirement which is web dynpro table loading with the data i need to sort the three columns
at a time. initially this sorted data is coming from Function module, but now the data is coming from BW to Web dynpro java
I have one method in sort class which will sort the table on one column at time. i need help in enhancing this method to work for three columns.
public void sort(String columnId, IWDNode dataSource) {
IWDTableColumn column =
(IWDTableColumn) table.getView().getElement(columnId);
ReversableComparator reversable =
(ReversableComparator) comparatorForColumn.get(column);
if (reversable == null)
return; // not a sortable column
// remove icon of previously sorted column
if (currentlySortedColumn != null
&& currentlySortedColumn.getHeader() != null)
currentlySortedColumn.getHeader().setImageSource(null);
// bookkeeping
if (column == currentlySortedColumn) {
// reversable.toggleReversed();
currentlySortedColumn = column;
// set icon in currently sorted column
/*if (currentlySortedColumn.getHeader() != null)
currentlySortedColumn.getHeader().setImageSource(
reversable.isReversed()
? "~sapicons/s_b_srtd.GIF"
: "~sapicons/s_b_srtu.GIF");
// sorting
dataSource.sortElements(reversable);
Regards,
Lakshmi KodavatiHi all,
The solution for EP6.40 Multiple column sorter
Class file:
http://wiki.sdn.sap.com/wiki/display/Snippets/Tablesorterbymultiplecolumns%28WebDynproJava%29
f you does not have WDTableColumnSortDirection try to modify the MultiAttributesNodeComparator and replace WDTableColumnSortDirection with the boolean flag-indicator of the sorting direction. Like this:
boolean sortAsc = true; // WDTableColumnSortDirection.UP
Call this class from web dynpro view
final MultiAttributesNodeComparator nodeComparator = new MultiAttributesNodeComparator();
nodeComparator.sortElements(new String[] {"InvoiceDate","Invoice","Contract"}, true, wdContext.nodeInvoiceListTable());
Thanks for Siarhei_Pisarenka
Edited by: narayana on Mar 25, 2010 10:02 AM
Edited by: narayana on Mar 25, 2010 10:05 AM -
We used to be able to sort by multiple columns/rows at once by right clicking on the header and choosing show more options-how do we do that in the new Numbers? It doesn't appear anywhere. Do I now have to sort massive tables by each column one at a time now? Also there used to be an easier way to merge/unmerge cells without me having to go to the table menu each time. Am I missing something?
Multiple column sort is a missing feature in the new version. Hopefully soon to return. You can do a multicolumn sort by sorting one at a time in reverse order of importance.
For merging and unmerging cells, I select the cells and right click to bring up the contextual menu. Merge and unmerge are on the menu. You could also create keyboard shortcuts for Merge Cells and Unmerge Cells in the Table menu. -
I am unable to sort multiple columns in a table created in Pages.
I had been using Appleworks up until I installed Lion and have now switched to iWork. I created a table within a Pages document and am able to sort a single column (using the Table Inspector and choosing Sort from Edit Rows and Columns) but the Sort option is grayed out when I attempt to sort multiple columns.
In another post, someone talked about this being a problem if you have merged fields. I do not believe I have done this (to be honest I don't know the function of merging fields).
This is very frustrating as I was easily able to sort these tables in Appleworks.Sharon Anderson wrote:
Thanks for your quick response! I have been trying that but then found that Numbers would only let me print in landscape view so I had to paste the table back into Pages. Is there a way to print in portrat view (from Numbers?)
Not so. In the lower left corner of the window, there's an icon that looks like a piece of paper. If you see this:
you are in Sheet View, or normal, mode. If you see this:
You are in Print View mode. Now you see the icons for portrait and landscape modes. Click your choice. Then arrange your content to fit the pages as you wish.
Jerry -
Can data be sorted by multiple columns in numbers version 3
Since upgrading Numbers to version 3 (now 3.0.1) I have been unable to sort data in spreadsheets using multiple columns. Anyone found a solution?
Regards
kurrajong60Here's a simple example. Say you want this sorted first by Region then by Name then by Amount.
So if you set up a sort index column with a simple formula and all you have to do is this (two clicks):
Giving you this:
Of course you could do it as I think Hiroto is suggesting and manually sort first by column B, then sort by C, then sort by A.
But that's a lot of trouble and it's easy to confuse the order so you end up having to start over again.
SG -
How to Sort Multiple Column In ALV_LIST_DISPLAY
Dear Experts,
Recently i've facing a problem to Sort multiple Column in ALV_LIST_DISPLAY.Whenever i need to sort 4 columns at a time , only 3 was sorted not the 4'th one.But i have already clearly mentioned in my sort section .Can anybody help me overcome this problem?
warm regards,
sameek mazumder.Hi samgpi,
You should have no prolem with doing such sorting by using the parameter IT_SORT, available when using class or FM...
Can you paste you sort section here so we can have a closer look?
Kr,
Manu. -
Sorting a Collection with dynamic columns using a custom compare function for multiple columns
I need help and ideas on how to sort a ListCollectionView. My problem is complicated by 3 requirements-
1. The column values contain HTML tags that needs to be removed before sorting (use custom compareFunction to strip HTML)
2. The columns are dynamic, so dataField names are not known at compile time (need a single compareFunction for all columns)
3. The data is used in an AdvancedDataGrid so multi-column sorting is required
I have figured out how to solve any 2 of the 3 requirements. However, I am having difficulties supporting all 3 requirements.
Any help or ideas would be greatly appreciated. Thanks.After playing with this some more I think I've figured out a solution. This seems to work in initial testing. Also, there is not a need to capture the current sort column in the headerRelease event which many offered solutions suggested. Another benefit to this solution is that keyboard initiated sorting is handled also. Whereas the headerRelease event is only triggered by a mouse click on the column header and special handling is required if the user uses the keyboard to access the column header.
One point that I don't understand is how ascending/decending order is determined. Behavior seems to be different between a single SortField versus multiple SortFields. Notice how the compareResults are handled for the different situations. Anyone out there know why???
private function colSortCompareFunction(obj1:Object, obj2:Object, fields:Array = null):int{
var compareResults:int = 0;
var newObj1:Object = new Object();
var newObj2:Object = new Object();
// should not be a condition that is met
if (_dataProviderDetails.sort.fields == null) {
var s:Sort = new Sort();
var f:Function = s.compareFunction;
return f.call(null, obj1, obj2, fields); }
// when a single column is selected for sorting
else if (_dataProviderDetails.sort.fields.length == 1) {
var firstFld:SortField = _dataProviderDetails.sort.fields[0];
newObj1[firstFld.name] = stripHTML(obj1[firstFld.name]as String); newObj2[firstFld.name] = stripHTML(obj2[firstFld.name]
as String);
compareResults = ObjectUtil.compare(newObj1[firstFld.name], newObj2[firstFld.name]);
return compareResults; }
// when multiple columns are selected for sorting
else {
for each (var fld:SortField in _dataProviderDetails.sort.fields) {
newObj1[fld.name] = stripHTML(obj1[fld.name]
as String); newObj2[fld.name] = stripHTML(obj2[fld.name]
as String);
compareResults = ObjectUtil.compare(newObj1[fld.name], newObj2[fld.name]);
if (compareResults != 0) {
if (fld.descending) {
return compareResults * -1; }
else {
return compareResults; }
return compareResults; }
Does anyone see any problems with this solution?
NOTE: stripHTML(String) is a simple function using regular expression to remove HTML tags.
Thx -
Sorting records based on multiple columns
Hi All,
Please provide SQK query to sort the records in multiple columns
based on NON NULL and NULL values.
SID SNUMBER UNIT COUNTRY STATE
0 M14762 DE 0
NULL NULL NULL NULL
0 990 GB
0 M14704 IE 0
M14767 IE 0
0 M14704 FR 0
0 M15351 990 GB
FR 0
0 D10693 800 GB 0
NULL NULL NULL NULL
0 D10693 800 GB 0
If all column values are NOT NULL those records should come first.
If first column(SID) values are NOT NULL those records should come next.
If second column(SNUMBER) values are NOT NULL those records should come next.
If third column(UNIT) values are NOT NULL those records should come next.
If fourth column(COUNTRY) values are NOT NULL those records should come next.
If fifth column(STATE) values are NOT NULL those records should come next.
If all the column values are NULL those records should come last.
The output should be like this.
SID SNUMBER UNIT COUNTRY STATE
0 D10693 800 GB 0
0 D10693 800 GB 0
0 M14762 DE 0
0 990 GB
0 M14704 IE 0
0 M14704 FR 0
0 M15351 990 GB
M14767 IE 0
FR 0
NULL NULL NULL NULL
NULL NULL NULL NULL
Please help me.
Thanks.Hi,
For Your Requirement,
SELECT COALESCE (SID, snumber, unit, country, state) SID,
(CASE
WHEN SID IS NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN unit
WHEN SID IS NOT NULL
AND snumber IS NULL
AND country IS NOT NULL
AND unit IS NOT NULL
AND state IS NOT NULL
THEN unit
WHEN SID IS NOT NULL AND snumber IS NOT NULL
THEN snumber
WHEN SID IS NULL
AND snumber IS NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NULL
AND state IS NOT NULL
THEN unit
WHEN SID IS NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NULL
THEN country
WHEN SID IS NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NULL
AND state IS NULL
THEN unit
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NULL
AND country IS NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NULL
THEN snumber
WHEN SID IS NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NULL
THEN country
when sid is not null and snumber is null and unit is null and country is not null and state is not null then country
ELSE NULL
END
) snumber,
(CASE
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NULL
AND state IS NOT NULL
THEN unit
WHEN SID IS NULL AND snumber IS NOT NULL AND unit IS NOT NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NULL
THEN unit
WHEN SID IS NOT NULL AND snumber IS NOT NULL AND unit IS NOT NULL
THEN unit
WHEN SID IS NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NULL
THEN country
when sid is not null and snumber is null and unit is null and country is not null and state is not null then state
ELSE NULL
END
) unit,
(CASE
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NULL
THEN country
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
THEN country
WHEN SID IS NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
ELSE NULL
END
) country,
(CASE
WHEN SID IS NOT NULL
AND snumber IS NOT NULL
AND unit IS NOT NULL
AND country IS NOT NULL
AND state IS NOT NULL
THEN state
ELSE NULL
END
) state
FROM tablx;
Cheers... -
Multiple columns from a query sorted vertically
Is it possible to sort a query resultset vertically, with
multiple columns across the page, in the following manner, with
page breaks after 40 rows? I can get it to sort horizontally just
fine with tables, but how can it be done vertically as shown?
JONES, Abby JONES, Betty JONES, Dawn JONES, Frank
JONES, Adam JONES, Bill JONES, Debbie JONES, Gayle
JONES, Alice JONES, Bob JONES, Denton JONES, Henry
JONES, Ben JONES, Cathy JONES, Emma JONES, JohnThis will get you started. I assume you had the appropriate
order by clause in your query. I also assume you want 4 columns per
line.
My approach would be to convert the query to an array and
then output the array.
columns = 4;
maxrows = 40;
recordsperpage = columns * rows;
records = query.recordcount;
myArray = ArrayNew(2);
ThisColumn = 1;
ThisRow = 1;
if (records gt recordsperpage)
LoopTill = recordsperpage;
else
LoopTill = records;
for ( ii = 1; ii lte LoopTill; ii = ii + 1){
myArray[ThisRow][ThisColumn] = query.field[ii];
increment ThisRow;
if (ThisRow = MaxRows + 1) {
ThisRow = 1;
increment ThisColumn;
} // if
} // looop
You can do the rest
Maybe you are looking for
-
It was a dark and stormy night... For the past eight years, I had been happy with Verizon wireless service. Great coverage and rarely a dropped call. However, all of that changed when I moved into a lovely mid-century modern condominium. The solid co
-
As I see required events, measure un-strained millivolt value, file, after applying force, measure strained millivolt value, determine difference between strained and unstrained, convert delta millivolts to strain, and present. Using NI strain gage b
-
Converting PC NTFS file system to Mac
I have just got a Mac and want to user the external hard drive that was previously used by my PC. I do not have read/write permission to the external hard drive - I guess because it is formatted for NTFS. Do I need to reformat the external drive to a
-
How do i delete apps from my iphone 4s?
How do I delete apps from my iphone 4s?
-
I have currently purchased Adobe Creative Suite 3 Web Standard and I am having problems understanding the PROPER way to design a website. For example: Can I design the website in Illustrator? Then where do I take the page in order to create buttons a