Solved

form params don't work for formfield generated by output query

Posted on 2003-12-09
4
184 Views
Last Modified: 2013-12-24
if i leave the form.OrderID blank even though i'm using <cfparam name="form.OrderID" default=""> (i've also used default="1")

i get the error:

An error occurred while evaluating the expression:


#ListGetAt(OrderID,Counter)#

In function ListGetAt(list, index [, delimiters]) the value of index, which is 1, is not a valid index for the list given as a the first argument (this list has 0 elements). Valid indexes are in the range 1 through the number of elements in the list

my code:

<CFLOOP INDEX=Counter FROM=1 TO=#ListLen(ExAutoArtID)#>
   <CFQUERY NAME="UpdateExBuilder" DATASOURCE="Ikonltd">
       UPDATE ExBuilder
       SET OrderID=#ListGetAt(OrderID,Counter)#,
ExID=#ListGetAt(ExID,Counter)#,
AutoArtID=#ListGetAt(AutoArtID,Counter)#
       WHERE ExAutoArtID=#ListGetAt(ExAutoArtID,Counter)#
   </CFQUERY></CFLOOP>

<cfquery name="Artwork" datasource="Ikonltd">
  SELECT Title, OrderID, ExBuilder.AutoArtID,ExBuilder.ExID,ExBuilder.ExAutoArtID FROM Artwork,ExBuilder WHERE ExBuilder.ExID = #FORM.ExID#
  and Artwork.AutoArtID=ExBuilder.AutoArtID
  </cfquery>

.....................................................

 <cfoutput query="Artwork">
      <tr>
        <td valign="middle">
          <p align="right">
            <input name="OrderID" type="text" id="OrderID" size="5" value="#OrderID#"></cfoutput>
0
Comment
Question by:phillystyle123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9909383
What should the orderID be if the variable is blank?

See if this helps:
<CFIF LISTLEN(orderID) gte counter>#ListGetAt(OrderID,Counter)#<CFELSE>NULL</CFIF>
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 9909429
basically it is saying the value of variable "Counter" is not a valid index, i.e. its probably not an integer.

#ListGetAt("item1, item2, item3", 2)# this is what the function would look like if parsed, maybe that clears things up?
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9910004
If u use
<cfparam name="OrderID" default="">
& in ur code below
#ListGetAt(OrderID,Counter)#

u r bound to get an error ! as u cannot use listgetat on a empty list !

u will need to chk if its blank or not or set it to some value.

i also see that u r running a loop & using counter to get the respective element from teh list
i hope ur list has all the elements ...

if not - u wld be better of checking - the length of the OrderID to be equal to ExAutoArtID [based on ur code]

I guess the logic has gone wrong here ... or may be u cld tell us what exactly is going on - so as to get a clear idea on what cld be done !

K'Rgds
Anand
0
 
LVL 11

Accepted Solution

by:
hart earned 100 total points
ID: 9910183
<CFLOOP INDEX=Counter FROM=1 TO=#ListLen(ExAutoArtID)#>
  <CFQUERY NAME="UpdateExBuilder" DATASOURCE="Ikonltd">
      UPDATE ExBuilder
      SET ExID=#ListGetAt(ExID,Counter)#,
      <cfif ListLen(OrderID) Gte Counter>
      OrderID=#ListGetAt(OrderID,Counter)#,
      </cfif>
      AutoArtID=#ListGetAt(AutoArtID,Counter)#
      WHERE ExAutoArtID=#ListGetAt(ExAutoArtID,Counter)#
  </CFQUERY>
</CFLOOP>

Regards
Hart
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question