| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. Bug in SORT DOWN #12491 | Try the following
code_sections.1 = RIGHT(100,8,'0') || 'Section 100'
code_sections.2 = RIGHT(120,8,'0') || 'Section 120'
code_sections.3 = RIGHT(80,8,'0') || 'Section 80'
code_sections.0 = 3
SORT down code_sections. a +8
DO i = 1 TO 3
SAY code_sections.i
END
Without the DOWN it works, with the DOWN it fails. Can't se that I'm doing anything wrong | 2. #12492 | Is this one of those "I'm trying to do a numeric sort with a string sort algorithm" things? SORT is an alphabetic sort. It doesn't sort by numeric value. To make a numeric sort work with this algorithm, all numbers must be padded out with leading zeros to be the same amount of digits (and no embedded spaces/commas) | 3. #12493 | Change the code a bit, and we find that code_sections.1 has been dropped Resulting in: Code_sections.1 does not exist 00000120Section 120 00000100Section 100
(Hey Michael, you could just Do i = 3 to 1 .... naw, just joking)
/* */ code_sections.1 = RIGHT(100,8,'0') || 'Section 100' code_sections.2 = RIGHT(120,8,'0') || 'Section 120' code_sections.3 = RIGHT(80,8,'0') || 'Section 80' code_sections.0 = 3
SORT down code_sections. a +8
DO i = 1 TO 3 If exists("Code_sections.i") = 1 then SAY code_sections.i else Say 'Code_sections.'i 'does not exist' ENDDoug | 4. #12494 | Jeff, just saw your post. Michael's data is zero filled. The problem is the sort leaves the .1 item dropped. Expand the Do to 4 and we get:
Code_sections.1 does not exist 00000120Section 120 00000100Section 100 00000080Section 80
/* */ code_sections.1 = RIGHT(100,8,'0') || 'Section 100' code_sections.2 = RIGHT(120,8,'0') || 'Section 120' code_sections.3 = RIGHT(80,8,'0') || 'Section 80' code_sections.0 = 3
SORT down code_sections. a +8
DO i = 1 TO 4 If exists("Code_sections.i") = 1 then SAY code_sections.i else Say 'Code_sections.'i 'does not exist' ENDDoug | 5. Exactly Doug #12495 | All you have to do is run the script and you fail on the first item. I'm 99.9999% certain this has worked before since I only discovered it today by accident in an old application that I know I've run many a time. | 6. Bump #12617 | | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|