couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Bonitz" <cbonit...@gmail.com>
Subject Calling other functions in views
Date Tue, 04 Mar 2008 09:10:45 GMT
Hello everybody,

I am trying to create several views that differ only in the value of
an integer variable in the javascript-function. I would love to do
something like

function(doc,n) {/* do something that depends on n*/}

but the view functions take only one argument. Currently I am
replicating code, i.e.

function(doc) {n = 1; /*snip*/}
function(doc) {n = 2; /*snip*/}
etc.

Is there a way to call another javascript function from a view function, i.e.

function(doc) {otherfunction(doc,1);}

or pass a parameter from the http-query? I have found nothing like
this in the wiki or on the web.

If there is a solution, I will create a wiki-page.

Thanks and best regards
Christoph

Mime
View raw message