[daisy] How To set a multivalue-field in documenttask

Karel Vervaeke karel at outerthought.org
Fri Jun 13 15:41:14 CEST 2008


So you need to chant the right incantation and hold some chickenbones
in the moonlight. 

Sorry, friday afternoon and all that, here's what you need:

['template'] is not seen as a java array (because, technically speaking,
it really isn't, it's a Javascript array thingy).

To create a Java array, you should write something along the lines of :

var valueArray =
Packages.java.lang.reflect.Array.newInstance(Packages.java.lang.String,
1)
valueArray[0] = 'template';

HTH,
Karel

ps: you may even need to write Package.java.lang.String('template'), but
I'm not sure.


On Fri, 2008-06-13 at 15:16 +0200, "Ehms, Jürgen" wrote:
> I like to change am multivaluevield in documenttask.
> 
> 
> var document = repository.getDocument(variantKey, true);
> document.setField('newscategory', ['template']);
> document.save();
> 
> I get this error:
> 
> org.mozilla.javascript.WrappedException: Wrapped org.outerj.daisy.repository.DocumentTypeInconsistencyException: The value for the multivalue-field "newscategory" should be an array. (#2)
> 	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
> 	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
> 	... more
> 
> How is to set up a java array in this task ??
> 
> Thanks for help
> 
> Juergen
> 
> MSC Vertriebs GmbH
> registered office : Stutensee
> Jurisdiction and registered Mannheim, Germany, HRB No. 10 3631
> Managing Director: Manfred Schwarztrauber, Lothar Kümmerlin, Rüdiger Kuhn
> 
> Gleichmann & Co. Electronics GmbH
> registered office : Frankenthal
> Jurisdiction and registered Ludwigshafen, Germany, HRB No. 21305
> Managing Director: Manfred Schwarztrauber, Thomas Klein
> 
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy


More information about the daisy mailing list