Re: Attempt to provide warning of sorting bug



After a bit of struggling, I managed to download and compile
sane collections of code to experiment with. Morten suggested looking
in commands.c, where I found the sort command quite easily and the
call to sheet_range_contains_region function which is, I believe, the
check for arrays in the sort range (in sheet.c).

I think I need to use sheet_foreach_cell_in_range for a first check, but am wondering if there is any write-up, even provisional, that will give me some examples of use. Afraid I am someone who learns mostly from examples rather than reading the book. I've been around long enough to know an example that works is worth a lot more than a book that may have errors. Essentially I need to learn how information is passed between the sub-programs, as it appears the setup is pretty organized with common data structures to move info around.

Plan is to first figure out if I can properly detect different conditions, namely:

1) is there a cell reference within the sort range

If there is, then
2) a) which of these references are absolute refs OUTSIDE the range (OK)
b) which are references within a row (sorting rows, so refs are across columns) (should be OK) c) which are references to other cells, possibly in the sort range (not OK)

Once I have code to test these conditions, I'll need to learn more about the GUI, as I want to be able to highlight cells, particularly the dangerous ones.

For info, a colleague had group work in his class and was marking the teams. If column F contained the marks, and row 1 was leader of team 1, row 2 team 2, row 3 team 3 and the rest of the rows were the rest of the students . He entered the team mark, then used =f1 or f2 or f3 to apply the mark. Then sorted! A mess.

If anyone else thinks this a worthwhile warning to add, do get in touch outside the list. Looks doable without too much pain. I'd like to make it work so folk can suggest how to do it better before suggesting it as a new feature.

JN

--
John C. Nash, School of Management, University of Ottawa,
Vanier Hall 451, 136 Jean-Jacques Lussier Private,
P.O. Box 450, Stn A, Ottawa, Ontario, K1N 6N5 Canada
email: nashjc on mail server uottawa.ca, voice mail: 613 562 5800 X 4796
fax 613 562 5164,  Web URL = http://macnash.admin.uottawa.ca
"Practical Forecasting for Managers" web site is at
http://www.arnoldpublishers.com/support/nash/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]