Getting an "ordered LISTOF" would require building a temporary view to order
the results then executing the LISTOF function against that set.

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence
Lustig
Sent: Tuesday, March 23, 2010 11:15
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: LISTOF question

 

<< 

the table is currently ordered (an unlikely to ever get out of order because
the PK is an autonumber).

>> 

 

No table is ever ordered in R:Base (or any other SQL based RDBMS).  The SQL
specification specifically states that relations have no natural order.  In
R:Base, the apparent order of the table will change depending on the nature
of the query you execute: index-only queries, for instance, will return
their results in index order.  Also, rows are moved around for reasons that
may not be immediately clear (for instance, when a NOTE field is updated).

 

<< 

I still don't see why R:BASE does not sort the LISTOF.

>> 

 

R:Base is sorting the LISTOF query.  The result set is:

 

LISTOF(part_id) 
 --------------- 
 4,1,5,2,9,3,7

 

and R:Base is putting that in order for you.  The row "4,1,5,2,9,3,7" sorts
first in that result set (it also sorts last, of course, since there's only
one row).

 

When you issue the command without the LISTOF, what R:Base does is:

 

1. Build a list of rows for the result set (there are seven).

2. Put them in order.

 

When you issue the command with the LISTOF, R:Base follows the exact same
procedure:

 

1. Build a list of rows for the result set (there is only one).

2. Put them in order.

 

This confused the heck out of me the first few times I used LISTOF in this
way, but once I thought about it I realized what order things were happening
in and why the results made sense.

--

Larry

 

Reply via email to