This was discussed just this week in the thread "The sum function (used in reduce)". I (and others) recommend using CouchApp to manage your view code and make use of its macro feature to import the shared code.
Nils Breunese. ________________________________________ Van: Elf [[email protected]] Verzonden: zondag 26 april 2009 12:13 Aan: [email protected] Onderwerp: share code between views I have database with documents (yeah, really). Each documents has alot of data. Depending on this data, document has state. Now state is counted by a view. I want not to store this state as separate field to make documents be very dynamic. Also, from time to time (at algorithm change) I need to modify status calculation function. The problem is I have several views (about 6-8 now) wich uses the same status calculation code. Modifying all of them to change 1-2 lines of codes is painfull. Is it possible to share code (for example, function) between several views? Anothe way i thinks about, was to push status calculation function into query server. But here is another problem - if document is not changed, but I change status calculation function, old view results will remains in results of quering my views. But, if I can make mark documents changed, or cache - obsolete, views will become actual. Is it possible to make so? -- ---------------- Best regards Elf mailto:[email protected] De informatie vervat in deze e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.
