From user-return-11559-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Sun Jul 18 23:31:06 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 23308 invoked from network); 18 Jul 2010 23:31:06 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Jul 2010 23:31:06 -0000 Received: (qmail 30500 invoked by uid 500); 18 Jul 2010 23:31:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 30451 invoked by uid 500); 18 Jul 2010 23:31:04 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 30443 invoked by uid 99); 18 Jul 2010 23:31:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Jul 2010 23:31:04 +0000 X-ASF-Spam-Status: No, hits=4.4 required=10.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of steven.prentice.87@gmail.com designates 209.85.214.180 as permitted sender) Received: from [209.85.214.180] (HELO mail-iw0-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Jul 2010 23:30:56 +0000 Received: by iwn8 with SMTP id 8so3249835iwn.11 for ; Sun, 18 Jul 2010 16:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=f78Y8A9pKXy9UpKuabCLWKhkHYh6Kk58/Br/6OhfI10=; b=yB+kiyzrttAPWJb6FTroxpoJH59FRwSuBzRD2HjnWdOJG8sbSYJ4t/4RLkxrb7f3iM xN+C12HCDfykKiXPbLTBtuREflqowGdhA2ebBbrauBqHyYxPjUkkMI0HircDf+UtPZ0Z 2n+H9921D1R/g3M7uvs9BqH/iQiCBeXQuIFTM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=vRLXopladFrFG/T2/VleGwnFxQfxC5o7029WNlasbd2XUcWfUAgfbC/Oj1osDyQn9B I/q4fFs3mI51ge0PzQSG0sKyHzbr3DePFW5+O4LvypyTgLXiLTSPp7E+jZVrKwzIuG1K PkGK3TdHJgMwg5kMPZRQytrHW9K1g8UJS4r0s= MIME-Version: 1.0 Received: by 10.231.32.200 with SMTP id e8mr4539337ibd.66.1279495775033; Sun, 18 Jul 2010 16:29:35 -0700 (PDT) Received: by 10.231.114.196 with HTTP; Sun, 18 Jul 2010 16:29:34 -0700 (PDT) In-Reply-To: <674A725A-4BAA-455F-9E69-B19433BA3DB7@gmail.com> References: <674A725A-4BAA-455F-9E69-B19433BA3DB7@gmail.com> Date: Mon, 19 Jul 2010 09:29:34 +1000 Message-ID: Subject: Re: using req.query to filter a list function in couchDB 0.10.0 From: Steven Prentice To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0022152d6eb129ad29048bb1d3e2 X-Virus-Checked: Checked by ClamAV on apache.org --0022152d6eb129ad29048bb1d3e2 Content-Type: text/plain; charset=ISO-8859-1 Oh yes, you were right, wow I feel so noob right now, thanks you probably saved me a day's worth of frustration =] cheers steve On Mon, Jul 19, 2010 at 9:22 AM, J Chris Anderson wrote: > > On Jul 18, 2010, at 4:12 PM, Steven Prentice wrote: > > > Hi, > > I am trying to use a list function to filter the results of a view in my > > database. I have developed the following code, but keep getting a > reference > > error when making a request: > > > > Request = curl -X GET > > > '..../_design/dates/_list/param/audit_resource_subresource_with_criteria?as="TestUser"' > > > > (param is the name of my list function) > > > > the function looks like this...what I am trying to do is allow someone to > > enter the name of the user to filter the view for just rows where the > > accessingsystem field = what is entered: > > > > function(head, req) > > { > > var accessingsystem = req.query['as']; > > var row; > > while(row = getRow()) > > { > > if (as && row.value[1] != as) > > { > > continue; > > } > > send(row.value); > > } > > } > > > > the error i get is {"code":500,"error":"render_error","reason":"function > > raised error: ReferenceError: as is not defined"} > > > > looks like a garden-variety JS error: > > "as" in the loop body should be replaced with accessingsystem > > > any help = much appreciated! > > Steve > > --0022152d6eb129ad29048bb1d3e2--