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