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

Extract row ID from a query (from cfspeadsheet)

Explorer ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

Hello,

I working with Coldfusion 10.

I use cfspreadsheet for reading an Excel document. The result is in query. See example below.

As you see (black circled) you have the row ID 1, 2 and 3 (representing the row number of the Excel sheet).

Query.jpg

I would like to read that value.

Question:

How can I read this value ?

Reason:

I must make a query of query to filter data.

In case of mistake (bad values or missing values) I must display an error message which explain that "wrong value on row xxx".

After the query of query, the quantity of rows are not the same as the Excel document and the row id is not correct.

My ideas is to add a column to the result of query of the query with the row id of the original query (which represent the row number).

I already search on internet, this forum. But I don't know how to do that !

Or any one have a better ideas?

Thank you so much for your help

Best regards

André L'Hoir

Views

243

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
Explorer ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

LATEST

Hello,

You can close the issue. I founded the solution (see code below)

<cfset queryAddColumn(YourQuery, "RowNum", ArrayNew(1)) />

<cfloop query="YourQuery">

   <cfset querySetCell(YourQuery, "RowNum", YourQuery.currentRow, YourQuery.currentRow) />

</cfloop>

So.. Thanks

Best regards

André L'Hoir

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