Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 21152 invoked from network); 18 Jul 2010 23:22:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Jul 2010 23:22:59 -0000 Received: (qmail 26262 invoked by uid 500); 18 Jul 2010 23:22:58 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 26159 invoked by uid 500); 18 Jul 2010 23:22:58 -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 26151 invoked by uid 99); 18 Jul 2010 23:22:58 -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:22:58 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 74.125.83.180 as permitted sender) Received: from [74.125.83.180] (HELO mail-pv0-f180.google.com) (74.125.83.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Jul 2010 23:22:49 +0000 Received: by pvg12 with SMTP id 12so3257765pvg.11 for ; Sun, 18 Jul 2010 16:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=S7y2+ELXPqP0xsPiAvHt70bhW0juslvFJvBtoug2zoc=; b=UoVvfARQlmrVT0Ai2kyphbYT0Kibl+sPOnFIS5KQAzcbepubdnf2wTQUoTZdZ6wxdO TUjEfln/ctwEcjOJ28vSqk+Pvaaaf5PVSd7zpAFa4VsrK398n5uAjm1F7D/DtY2NTzc2 syHlEezsBsGyLwVdA7I5/zVgoe6+EpSvwkybs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=w1+C21ow/Y4h/QVGnQtwA9yX0Z06AHysarWyue+X+0gAE2JP282HUF7uDbsSrEnAlo ffsSuM2Pr3WnVRRzJ4g819vgIoUK+BaoBdsc0fh2s+ACDLI95hR1LMhe7zYtsoQgbzvG VmDCiqm9i5FWHedFByM2Vh3RizHObDhgGT70g= Received: by 10.142.207.5 with SMTP id e5mr1516410wfg.229.1279495348150; Sun, 18 Jul 2010 16:22:28 -0700 (PDT) Received: from [192.168.1.102] (c-98-248-172-14.hsd1.ca.comcast.net [98.248.172.14]) by mx.google.com with ESMTPS id 33sm5672766wfd.6.2010.07.18.16.22.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 18 Jul 2010 16:22:26 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: using req.query to filter a list function in couchDB 0.10.0 From: J Chris Anderson In-Reply-To: Date: Sun, 18 Jul 2010 16:22:24 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <674A725A-4BAA-455F-9E69-B19433BA3DB7@gmail.com> References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on apache.org 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: >=20 > Request =3D curl -X GET > = '..../_design/dates/_list/param/audit_resource_subresource_with_criteria?a= s=3D"TestUser"' >=20 > (param is the name of my list function) >=20 > 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 =3D what is entered: >=20 > function(head, req) > { > var accessingsystem =3D req.query['as']; > var row; > while(row =3D getRow()) > { > if (as && row.value[1] !=3D as) > { > continue; > } > send(row.value); > } > } >=20 > the error i get is = {"code":500,"error":"render_error","reason":"function > raised error: ReferenceError: as is not defined"} >=20 looks like a garden-variety JS error: "as" in the loop body should be replaced with accessingsystem > any help =3D much appreciated! > Steve