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

cf file

Guest
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

hi just a small issue i have, i am using cffile to upload a csv file, the csv file has a id column which i use to add a id for each row

ie

<input type="hidden" name="ID_#getHTTP.CurrentRow#" value="#getHTTP.ID#">

can i have csv files without the id column and somehow use currentrow for the form element ID above?
TOPICS
Advanced techniques

Views

284

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

correct answers 1 Correct answer

LEGEND , Apr 06, 2007 Apr 06, 2007
craiglaw98 wrote:
> ok think i get it, so if i have the csv with 3 columns
>
> Fname, Sname, Phone
>
> how would i get the id for each row?

if you do not have an ID column in your csv, or a column which can be
used as ID, then you have to create it at parsing. you can use the
currentrow of csv file as id, for example...

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

Votes

Translate

Translate
Guest
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

I would think so. It shouldn't be difficult to try it out in your particular environment.

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
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

ok but how would i get the value of the form element ID from the 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
Engaged ,
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

CSV reads in as "column1", "column2", etc etc

Therefore you would need to read the row from the CSV file and treat it as an array of values separated by a delimiter -- obviously a comma in this case. Therefore you would need to know what column the ID value is always in and call it that way.

i.e. ListGetAt(mylist,2) ... if ID was in position #2

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
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

ok think i get it, so if i have the csv with 3 columns

Fname, Sname, Phone

how would i get the id for each row?

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 ,
Apr 06, 2007 Apr 06, 2007

Copy link to clipboard

Copied

LATEST
craiglaw98 wrote:
> ok think i get it, so if i have the csv with 3 columns
>
> Fname, Sname, Phone
>
> how would i get the id for each row?

if you do not have an ID column in your csv, or a column which can be
used as ID, then you have to create it at parsing. you can use the
currentrow of csv file as id, for example...

--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
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
Resources
Documentation