[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]]
==== Column Sort (OpenInsight Specific) ====
=== At 20 AUG 1998 08:31:46PM Marty Rosenbloom wrote: ===
{{tag>"OpenInsight Specific"}}
I would like to send to Reporter selected keys sorted in order of a calculated field, not in key order.
I have a calculated column called "PERCENTS". I would like my reports to be sorted on this column. The key column is called "SOCIAL". I have tried setting up a selection criteria in Reporter and using RevRpt, Select...By in events, BTree.Extract in events, Extract_SI_Keys and a host of other possibilities. The BTree.Extract and Extract_SI_Keys gets me the keys and I can print all the correct rows but not in the proper order. I would like the lowest percent to print first followed in order by the rest of the pack.
TIA,
Marty
----
=== At 20 AUG 1998 08:45PM Dave Pociu wrote: ===
Have you tried saving your list of keys (in the right order of percentages) to SYSLISTS (under say LIST_NAME:@STATION) and then using GETLIST LIST_NAME@STATION in Reporter (Basic+ Query) to get the list?
Obviously, there should be no sorting in the Reporter report. This sould print the records associated with the keys in the order that they were obtained from the list.
----
=== At 21 AUG 1998 09:57AM Marty Rosenbloom wrote: ===
]]Have you tried saving your list of keys (in the right order of percentages) to SYSLISTS (under say LIST_NAME:@STATION)and then using GETLIST LIST_NAME@STATION in Reporter (Basic+ Query) to get the list?<<
This is exactly what I use but I don't know how to sort the keys to percentage order.
Marty
----
=== At 24 AUG 1998 12:24AM Dave Pociu wrote: ===
I guess I misunderstood what you needed. Here's the code for what you need to do:
declare subroutine RLIST
open '','SYSLISTS' to syslists_handle else
msg( @window , "Cannot open SYSLISTS table")
return
statement=SELECT TABLENAME BY PERCENTAGES" ;** replace TABLENAME with your actual table name
rlist( statement , 5 , '' ,'','') ;* create sorted list by id
done=0
list='
loop
readnext id else
done=1
end
until done do
if list=' then
list=id
end else
list := (@fm: id) ;* this works faster that list=id for big lists
end
repeat
write list on syslists_handle, "PERCENTAGES":@STATION else
*** some error message
end
*** report call here
return
Using RLIST is the key to it all. I prefer using 5 as the RLIST parameter and then create and write the list myself. You could also have RLIST create and save the list for you automatically, but I had some instances when the list had extra items ( like a pseudo-heading) so I prefer the method above.
----
=== At 24 AUG 1998 11:36AM DSig (SigSolutions) wrote: ===
David ..
instead of ...
if list=' then
list=id
end else
list := (@fm: id)
end
try ..
List := @Fm : Id ;*just contact to list in loop
then
List1,1=" ;* after loop
we did some tests a long time ago and it was faster in large numbers of loops .. and removes one more if/then that you have to read
dsig
David Tod Sigafoos ~ SigSolutions
dsig@teleport.com
----
=== At 24 AUG 1998 12:47PM Cameron Revelation wrote: ===
dsig,
... in that case , you should append the delimiter after each item (not before each item) since:
List-1,1="
... should theoretically require one less memory allocation and copy.
However, on a brand new workstation with a memory transfer rate of about 600mb/sec, this will only save you about 1/10000 of a second.
Cameron Purdy
Revelation Software
----
=== At 24 AUG 1998 12:52PM Dave Pociu wrote: ===
You're just a speed demon Dsig! ;)
----
=== At 28 AUG 1998 10:37PM Marty Rosenbloom wrote: ===
Wow, this response is overwhelming. Thank you one and all for your help!!
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=6EBA06239957B762852566670002E88B|View this thread on the forum...]]