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

how to fetch/pull/extract data from dashboard widgets of RTC.

I have a widget that contain a list of defect work items and there is a count present on widgets i.e how many defect work items are in the given widgets .I want to know how to pull that  count value from widgets and have some calculus on it.

Anyone can help me on same?

Best Regard
Krunal.

0 votes

Comments

 Thanks Jonas, 


Can you please give it to me in JAVA Script.

I want to show it in the form of Widgets.

Best Regards,
Krunal.



One answer

Permanent link

Hello there Krunal,

First thing.
In what language? Javascript or Java?

Second thing.
Is this a built in Widget or a third party one?

Greetings

0 votes

Comments

Depends how you can access the Widget.

1:
If its a built in Widget you have to access it externally.
Maybe its easier to just read the HTML-Label if you need that value.
But I do NOT suggest this!

2:
If it's your own code you just have to read the distinct value.
Then it depends on how this value is  set. Maybe Array.length.

I really don't get what you want to achieve since it's not that easy to access data inside a Widget. The other point is, that this value is only present when this particular widget is loaded. So it's kind of dangerous to build logic on that value.

1 vote

 Hi Jonas,


I would like to describe you my use case for same.

Case:1
I want to calculate Defect Density for my Project. we are going to calculate Defect Density using below formula:
 i. DD=Number of Defects/ Kilo Lines of Code.
 ii.DD=Number of Defects/No of test cases. 
 
Case:2
I want to show the calculated value in below format
i. If possible in the form of Report. 
ii. In the form of Widgets on dashboard.

Challenges are:
1. How to fetch live number of  defects count data
2. How to show the calculated DD on Dashboard.

Best Regards.
Krunal

Hy Krunal,

Ok I might have an Idea how you could achieve that use case.
But remember, I'm just useful for Javascript questions since I haven't that much experience on the client side Java API.

My steps to achieve that would be:
1: Build a query which represents the data I need.
2: Get the query data over XHR
  -Now you know exactly how much defects are in your system.
   Where do you store the information about the "Kilo Lines of Code"?
   If it's a value inside the defect it's also easy to calculate this because through the query you'll also have the different Workitems (defects in that case)

3: Display the whole thing in HTML the way you want.
1: How to detect how many Defects are in the System?

I'd suggest you to build this logic with a query.

2: Then load the query into your Widget with XHR.

Maybe you do wonder how could I access a query and its data?
This will do the trick
https://myServer.xy/application(This case ccm)/oslc/queries/queryID
https://myServer.xy/ccm/oslc/queries/_te5rttgzuhjit45

1 vote

Logic
require -> "dojo/request/xhr"
require -> "dojo/Deferred"
getRequest: function(url, returnType, preventCache){
    returnType = (returnType) ? returnType : "text";
    preventCache = (preventCache) ? preventCache : false;
    //Header should be based on the return type
    var xhrHeader = {"accept":"application/xml"};
    var deferred = new Deferred();
    xhr(url, {
        handleAs: returnType,
        method: "GET",
        headers: xhrHeader,
        preventCache: preventCache,
        sync: false
    }).then(function(response){
        deferred.resolve(response);
    }, function(error){
        deferred.reject(error);
    });
    return deferred;
},

/*Usage*/
var  queryToLoad = "https://myServer.xy/ccm/oslc/queries/_te5rttgzuhjit45"
getRequest(queryToLoad, "json", true).then(function(innerResponse){
    //Handle success
}, function(err){
    //Handle error
});

 Thanks Jonas,


1.
I am planning to store the value of Kilo Lines of Codes in Customized Work Item.

2.
Regarding number of defects in a system, we can achieve this using query(Defect list ) and Dashboard widgets  (on upper right side its shows number of defects) I want to pull that count (number of defects)
into my WI attribute and have some calculus on it.
I think REST(XHR - Get) will be helpful for me.

If you have any suggestion on it, will be admirable.

Thanks a lot.
Krunal 
krunalgaoli@gmail.com

showing 5 of 7 show 2 more comments

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
× 10,926
× 411
× 152
× 3

Question asked: Mar 16 '17, 6:38 a.m.

Question was seen: 4,486 times

Last updated: Mar 24 '17, 12:51 a.m.

Confirmation Cancel Confirm