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

ListSort ::||

Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

Good morning all.

I have a list like this [ \h12\|ctr10|img0.dgn|doc1, \h13\|ctr12|img0.dgn|doc2, \h13\|ctr13|img0.dgn|doc3, \h13\|ctr10|img0.dgn|doc40, \h13\|ctr15|img0.dgn|doc2, \h13\|ctr12|img0.dgn|doc2 ]

I want to sort the list based on " ctr " value..I need to put the same "ctr" right after one another ...Any help ?
TOPICS
Advanced techniques

Views

1.2K

Translate

Translate

Report

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
LEGEND ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

Your question is too vague. Show the list the way you want it sorted.

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

<cfset a =" \h12\|ctr10|img0.dgn|doc1, \h13\|ctr12|img0.dgn|doc2, \h13\|ctr13|img0.dgn|doc3, \h13\|ctr10|img0.dgn|doc40, \h13\|ctr15|img0.dgn|doc2, \h13\|ctr12|img0.dgn|doc2 " >

Is that more clear now ?

Votes

Translate

Translate

Report

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
LEGEND ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: emmim44
<cfset a =" \h12\|ctr10|img0.dgn|doc1, \h13\|ctr12|img0.dgn|doc2, \h13\|ctr13|img0.dgn|doc3, \h13\|ctr10|img0.dgn|doc40, \h13\|ctr15|img0.dgn|doc2, \h13\|ctr12|img0.dgn|doc2 " >

Is that more clear now ?

Looks a lot like the unsorted list. Only difference appears to be the line wrap.

Votes

Translate

Translate

Report

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
LEGEND ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

no, not at all.
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

I wan the list to be like this.
<cfset a ="
\h12\|ctr10|img0.dgn|doc1,
\h13\|ctr10|img0.dgn|doc40,
\h13\|ctr12|img0.dgn|doc2,
\h13\|ctr12|img0.dgn|doc3,
\h13\|ctr13|img0.dgn|doc3,
\h13\|ctr15|img0.dgn|doc2,
" >

Votes

Translate

Translate

Report

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
LEGEND ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: emmim44
I wan the list to be like this.
<cfset a ="
\h12\|ctr10|img0.dgn|doc1,
\h13\|ctr10|img0.dgn|doc40,
\h13\|ctr12|img0.dgn|doc2,
\h13\|ctr12|img0.dgn|doc3,
\h13\|ctr13|img0.dgn|doc3,
\h13\|ctr15|img0.dgn|doc2,
" >


Do some looping to put your original list into a query. Use q of q to sort it.

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

I dont get understand Dan ...!?

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

What do you mean by Use q of q to sort it.?

Votes

Translate

Translate

Report

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
LEGEND ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: emmim44
What do you mean by Use q of q to sort it.?

Once you have your query populated, select all the fields and use the order by clause to sort it.

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

I will try...Thanks for now all.

Votes

Translate

Translate

Report

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
Participant ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

I created the test scenerio but still dont know how sort based on contract and DocId....The Contract is the first right element before comma and the DocId is the second most rigth element before comma....

<cfset aList="
http://bt2b/EazySearch/Eng/ARCHIVAL/RASTER/CBB002/CM-24/|X044G001.TIF|59018|CM-24,http://bt2b/EazySe...

">

<cfset qLetter = QueryNew( "" ) />

<cfset QueryAddColumn(
qLetter,
"ImgName",
"VARCHAR",
ListToArray(aList)

) />

<cfoutput query="qLetter">
#ImgName#
</cfoutput>

Votes

Translate

Translate

Report

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
LEGEND ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

I would have created my query with 4 fields because eventually you have to use one of them for sorting.

Votes

Translate

Translate

Report

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
Participant ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

I have created the 4 column but I received errr...
The err:::
The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request
Error casting an object of type to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.

Votes

Translate

Translate

Report

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
Guide ,
May 05, 2007 May 05, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: Dan Bracuk
Once you have your query populated, select all the fields and use the order by clause to sort it.


quote:

Originally posted by: emmim44
I have created the 4 column but I received errr...
The err:::
The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request
Error casting an object of type to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.

<cfset qLetter.sort(columnId, 1)>



They suggested using a QoQ with an ORDER BY clause. You're not doing that. I see no need to use the internal sort() method here. But if you do choose to use it, understand how it works.


Votes

Translate

Translate

Report

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
LEGEND ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

If it was me, and it's not, I'd define the four fields and their datatypes in the querynew function. Then I'd populate it with nested loops through the origninal list.

Votes

Translate

Translate

Report

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
Participant ,
May 07, 2007 May 07, 2007

Copy link to clipboard

Copied

Ok. forget about the sort part. I removed it...why I am getting that error then..

Votes

Translate

Translate

Report

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
Guide ,
May 07, 2007 May 07, 2007

Copy link to clipboard

Copied

Take a look at your cfdump. You're populating the query with arrays, not simple values.

Votes

Translate

Translate

Report

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
Participant ,
May 07, 2007 May 07, 2007

Copy link to clipboard

Copied

LATEST
Thanks all. it is done...

Votes

Translate

Translate

Report

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
Documentation