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

How to display query result like this

Guest
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

I got a query...gives list of names.

i want to display

11.  Peter

12. Jessica

32. Leo

15. Jamie

36. Edward

how i get static number infront of my query result.

static number is not in order.

Views

1.9K

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 ,
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

From where do these numbers come?

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
Guest
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

numbers are hardcoded.

i got 15 numbers...this is fixed.

query result maybe 14 or 13 or 15 or 12...this result will never exceed 15.

i want to display query result with hardcoded number.

11.  Peter

12. Jessica

13. Leo

14. Jamie

15. Edward

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 ,
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

Is there any correlation between the number and name?

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
Guest
Aug 03, 2012 Aug 03, 2012

Copy link to clipboard

Copied

No correlation.

Numbers are static number in squecne. Number is range.

Name are query result.

How can i display both together?

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
Engaged ,
Aug 03, 2012 Aug 03, 2012

Copy link to clipboard

Copied

#QueryName.CurrentRow# ????

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
Community Expert ,
Aug 03, 2012 Aug 03, 2012

Copy link to clipboard

Copied

LATEST

Amm85 wrote:

I got a query...gives list of names.

i want to display

11.  Peter

12. Jessica

32. Leo

15. Jamie

36. Edward

how i get static number infront of my query result.

static number is not in order.

You could use the function queryAddColumn to add the numbers as a separate column to the query.

Let us suppose the name of the query is "myQuery". Then you could proceed as follows

<!---Define your "static" list of numbers --->

<cfset staticList = "11,12,32,15,36,13,23,14,33,16,44,31,17,34,18">

<!--- Create an array from the static list. --->

<cfset staticNrArray = ArrayNew(1)>

<cfset staticNrArray = listToArray(staticList)>

<!--- Add the array as a column to the query. --->

<cfset nColumnNumber = QueryAddColumn(myQuery, "staticNr", "integer", staticNrArray)>

<!--- Verify whether it works as expected--->

<cfdump var="#myQuery#">

The list I have given here has 15 numbers. This will naturally instruct ColdFusion to add a new column named staticNr, having 15 rows. You might like to know that the queryAddColumn function enables padding.

Here is how it works. Suppose that the query originally had only 8 rows before you added the column(of 15 rows). Then, in the new query, ColdFusion would pad the last 7 rows of the other columns with null values. If the original query  had 20 rows instead, then Coldfusion would pad the last 5 rows corresponding to the staticNr-column with null 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
Resources
Documentation