Js.input.read

From Web Computing Documentation
(Difference between revisions)
Jump to: navigation, search
 
Line 3: Line 3:
 
''Returns the input string provided by the [[work source]] corresponding to the given name. Returns null if the [[work source]] doesn't contain an input under the given a name.''
 
''Returns the input string provided by the [[work source]] corresponding to the given name. Returns null if the [[work source]] doesn't contain an input under the given a name.''
   
<div style="background-color:#dddddd;width:600px;padding:10px;border-style:dotted;border-width:2px;border-color:#D45500">
+
<div class="function_definition">
 
'''<big>js.input.read( name )</big>'''
 
'''<big>js.input.read( name )</big>'''
 
----
 
----

Latest revision as of 10:59, 11 July 2011

Description

Returns the input string provided by the work source corresponding to the given name. Returns null if the work source doesn't contain an input under the given a name.

js.input.read( name )


name The name of the required input.


This function can be used to grab the input data at the beginning of a computation. If your input is JSON and you need to work with an object input, you can use js.evalJson.

[edit] Examples

var input = js.input.read("initialParameters");
if(input == null)
    return -1;     //No input found with the given name

initialParameters is an input name contained in the work source. For example in a BOINC project it is the logical name for the input data given in the workunit template.

Personal tools
Modules