Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Drop Down List not sorting correctly

Explorer ,
Aug 11, 2009 Aug 11, 2009

Hi,

I have a query that I use in a drop down form. NOMEN.GENERIC_NOMEN is the values that I want displayed in the drop down

While the value I want to select is NOMEN.NOMENCLATURE_ID.

Here is the underlying Query (notice it is sorted by the form values that I want to display)

<cfquery name="NOMEN" datasource="ilmf_parts_dev" blockfactor="100">
SELECT *
FROM NOMEN_TABLE
ORDER BY GENERIC_NOMEN ASC
</cfquery>

Here is the code for that part of the form:

<td width="96" class="style1">Nomenclature</td>
      <td width="379" class="style1"><cfselect name="Add_Inv_Nomen">
          <cfoutput query="NOMEN">
            <option value="#NOMEN.NOMENCLATURE_ID#">#NOMEN.GENERIC_NOMEN#</option>
          </cfoutput>
      </cfselect>      </td>

For some reason, the drop down displays the text in the order of the table index instead of alphabetically in ASC order.

Any Ideas?

Eric

Ps     Running off of Oracle 11g DB.

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2009 Aug 11, 2009

What's the outcome if you cfdump the query results?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2009 Aug 11, 2009

It does not come out in alphabetical order (seems like it should !)

Look at how the Printer entries are broken up...

Eric

query
GENERIC_NOMENNOMENCLATURE_ID
1DRIVE, DVD4
2PRINTER , ROLLER39
3PRINTER, FUSER40
4PRINTER, KIT41
5AC ADAPTER22
6BATTERY35
7CABLE12
8CARD, CONTROLLER38
9CARD, NIC7
10CARD, SOUND17
11CARD, VIDEO15
12COMPUTER8
13CPU13
14DIMM3
15DRAC MODULE27
16DRIVE, CD ROM19
17DRIVE, FLOPPY37
18DRIVE, REMOVABLE32
19DRIVE, ZIP33
20FAN20
21FIBER MODULE30
22FIBER OPTIC MODULE18
23HARD DRIVE1
24KEYBOARD2
25MONITOR6
26MOTHER BD, COMPUTER26
27MOUSE23
28NETWORK SWITCH25
29NUT, RETAINING29
30POWER SUPPLY5
31PRINTER9
32PRINTER, CARD16
33PRINTER, PART43
34PRINTER, TRANSFER11
35RAM, NV21
36SCREW, PHILLIPS HEAD28
37SPEAKER(s)14
38SWITCH24
39TERMINAL, RS23231
40TESTER, AC POLARITY36
41TONER CARTRIDGE10
42TRANCEIVER MODULE34
43UNKNOWN NOMENCLATURE0
CACHEDfalse
EXECUTIONTIME0
SQLSELECT * FROM NOMEN_TABLE ORDER BY GENERIC_NOMEN ASC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2009 Aug 11, 2009

Another simple/dumb question but will help trace the issue...

Can you run the same statement directly inside of the oracle environment, apart from coldfusion, and see what the result set is if you haven't already?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2009 Aug 11, 2009

I haven't used blockfactor but I guess I would try to drop that and see what happens. I don't see it causing issues but if we can strip down to the very basics it may be a better starting point. (Again, you may have tried this)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2009 Aug 11, 2009

Removing "Blockfactor" has no effect on the problem.

I also ran the query directly in Oracle SQL Developer and it sorted in the same incorrect order.

I think it has something to do with sorting on VARCHAR2 feild types...

Eric

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2009 Aug 11, 2009

Yep, that'd be the cause. I know you can use some decode/replace functionality within the sql to sort a varchar2 but I'm not positive of the structure of those statements. Sorry I couldn't be of any additional help. Good luck.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 12, 2009 Aug 12, 2009
LATEST

For the benifit of others with this problem, I will expose myself as an idiot and reveal the solution...

There was a space character before 3 of the PRINTER entries in the table. This is why

those three did not sort correctly. I did not notice this initially as I did not have my glasses.

Eric

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources