« Return to Thread: Setting a custom field in flowscript alters value of another field

Re: Setting a custom field in flowscript alters value of another field

by Paul Focke :: Rate this Message:

Reply to Author | View in Thread

Hi Nick

Are you experiencing the same problems when adding custom fields through the default daisy editor?

Aside from this I'd also advise against using custom fields for document hit counts. First of all you'll probably get some errors when trying to record hit counts when someone is editing the document. Of course you might be able to solve this by using some kind of queuing system. Secondly when a document has been edited the navigation tree will be invalidated which means it'll have to rebuilt on the next request. Since everytime you consult a document you are changing it means that the whole navigation will be rebuilt on every request. Now for small navigation trees this won't really be a biggy but might become a pain when you have query based navigation nodes and a large document set. So maybe it would be better to store document hit counts in a separate database.

But that aside it is weird that editing a custom field has an influence on another field. If you are only getting this in your extension (not the document editor) then maybe it might be a good idea to look over the code to see that you aren't accidently modifing the date field. If you are getting this in the document editor then we might be dealing with a bug here. The daisy version you are using might also be useful to us.


Paul

On Thu, Jul 2, 2009 at 5:50 PM, Nick <mcdonaldn2000@...> wrote:
Hello All,

I've implemented a simple hit counter that adjusts a custom field ("HitCount")
on a document every time the document is refreshed. I'm doing this by calling an
extension that grabs the document, updates its hit count by calling:

document.setCustomField("HitCount", java.lang.Integer.parseInt(hits));
document.save();


On certain documents, I have a field called DocumentPostDate (not a custom
field, but one I defined in the Administration tab). This field contains a date
value that is set once when the document is created and then never adjusted.

The problem is, when I call setCustomField(), it (for some reason) is
decrementing the DocumentPostDate field. This happens no matter what custom
field I'm setting (I see the same problem if I change it to
document.setCustomField("NewField", "New Value")), and it stops happening as
soon as I comment out the call to setCustomField().

After some further testing with various fields, it looks like it always
decrements date values (but doesn't affect any other field types as far as I can
tell).

Does anybody have any clue what could be happening here?

Thanks in advance,

Nick


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

 « Return to Thread: Setting a custom field in flowscript alters value of another field