Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Can valeSetProvider scripts read their data from local text files?

I'm no dojo expert by any means and I'm looking to see if it is possible to have a dojo script open a file on our server (\\server\somefile) to fetch the data for the result.   I.e. All we do after uploading the script is have to modify the text file on server (dynamic list).

I'm basing on the script example shown here.
/*******************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:  
 * Use, duplication or disclosure restricted by GSA ADP Schedule 
 * Contract with IBM Corp. 
 *******************************************************************************/
dojo.provide("com.example.ValueSetProvider");

(function() {
    dojo.declare("com.example.ValueSetProvider", null, {

        getValueSet: function(attributeId, workItem, configuration) {
       
            var result= [];  
            result.push("a");   <-- would like to fetch this from File I/O.
            result.push("b");
            return result;
            
        }
   });
})();

1 vote



2 answers

Permanent link
I'm not sure if this is possible with ValueSetProvider script (I think it's not.).
Anyway, instead scripts, you should use HTTP Filtered Value Set, which allows you to fetch set of values from XML document via HTTP protocol.

0 votes

Comments

right, but you have to have an HTTP server for that..


Permanent link
So I went the http filtered value set route.   I setup apache and serving an xml page. 

<xml>
<node>
<value>Tom 1</value>
</node>
<node>
<value>Tom 2</value>
</node>
<node>
<value>Tom 3</value>
</node>
</xml>

When I run the test everything works,

[HttpFilteredValueSetProvider]Retrieving values from HttpConnector...
[HttpConnector]Retrieving XML document...
[HttpConnector]Issue a new HTTP requestGET /test.xml
Accept: application/xml
Host: 192.168.6.119
Connection: Keep-Alive
[HttpConnector]Got response 'OK'200 OK
Date: Fri, 31 May 2013 20:25:29 GMT
Server: Apache/2.4.2 (Win64) OpenSSL/1.0.1
Last-Modified: Fri, 31 May 2013 20:22:56 GMT
ETag: "8e-4de096164a8bc"
Accept-Ranges: bytes
Content-Length: 142
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/xml
[HttpConnector]Retrieved XML document<xml>
<node>
<value>Tom 1</value>
</node>
<node>
<value>Tom 2</value>
</node>
<node>
<value>Tom 3</value>
</node>
</xml>
[HttpConnector]Identified 3 rowsXPath: //xml/node
[HttpFilteredValueSetProvider]Retrieved 3 values

Yay! But then I tried creating an attribute (small string) and placing it in a presentation.  
No matter what I do, I always get a blank control on the presentation.

Any ideas?

0 votes

Comments

Btw, I wanted to thank you Karol, long ago I looked at both approaches,  but completely forgot about the HTTP filtered approach. 


Thanks!

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,023

Question asked: May 31 '13, 1:20 p.m.

Question was seen: 3,794 times

Last updated: May 31 '13, 4:40 p.m.

Confirmation Cancel Confirm