Search Support
-
Sabina Rosa Olga LuzzattiOctober 21, 2016 at 2:31 am #2915
I have some doubts about how to implement drill down functionality. Everything works well if
drill down data are explicitly defined in server scriptlet, as explained in the article “How to create a drill down
Tree for charts” but I have to call a service to retrieve data for drilldown.
This is the case explained in pdf “Leveraging the IBM BPM Coach Framework in Your Organization
Chapter 4: SPARK UI Toolkit – Unabridged”. I’m reading page 114
and the call equivalent to the one you defined asvar regions = MediaConsumptionDB.selectRegions (type, subtype)
doesn’t work because my MediaConsumptionDB (that is a js lib)
at runtime results not defined even if it’s added to Designer (Files–> Server file).
What did I miss ?
Thank you in advance
SabinaSPARK SupportOctober 24, 2016 at 1:17 pm #2924Hi Sabina,
I have reached out to our Development Team with your question. We would like to take a look at your implementation.
Can you upload a copy of your TWX file to the following directory?
https://sftp.salientprocess.com/sharing/FlfdXXDqr
Regards,
Stephen P.
Sabina Rosa Olga LuzzattiOctober 25, 2016 at 1:18 am #2928Hi Stephen,
I uploaded the twx . After a server restart, the implementation now works.
What I miss now is to understand how is to understand how to retrieve the selected region in the input data of the ajax service.
Thank you very much
Sabina
SPARK SupportOctober 25, 2016 at 10:44 am #2930Hi Sabina,
The implementation code of the Drill Down Tree script initialized the dataSeries variable with the Data Ponts here:
<script>
<![CDATA[
var regioni = [“Lombardia”, “Lazio”];
var pop =[10002615,5892425];
tw.local.dataSeries.dataPoints = new tw.object.listOf.DataPoint();
for(var x = 0; x< regioni.length; x++) {
tw.local.dataSeries.dataPoints[x] = new tw.object.DataPoint();
tw.local.dataSeries.dataPoints[x].label = regioni[x];
tw.local.dataSeries.dataPoints[x].value =pop[x];
}
]]>
</script>Is this what you are looking for?
Regards,
Stephen P.
Sabina Rosa Olga LuzzattiOctober 25, 2016 at 12:56 pm #2932Hi Stephen,
no this is not the point. When I click on one of the two regions the ajax service is invoked. In the present implementation, the name of the selected region is retrieved in the following way:
<js-query description=”Popolazione per provincia”>
<in>
<field var=”region” ref = “../@value/” />
</in>What I need is to retrieve the selected region as input parameter of the ajax service and not as described above.
Thank you very much
Sabina
SPARK SupportOctober 25, 2016 at 2:41 pm #2934Hi Sabina,
In the following code, the user selected “region” is set as the variable region, which is passed as an argument to getPopulationByProvince(). You could create any function here to handle the region variable.
<js-query description=”Popolazione per provincia”>
<in>
<field var=”region” ref = “../@value/” />
</in>
<script>
<![CDATA[
var data = DrillDownDB.getPopulationByProvince(region);
populateDataSeries(data);
]]>
</script>
</js-query>What is the implementation that you are trying to achieve?
Regards,
Stephen P.
Sabina Rosa Olga LuzzattiOctober 26, 2016 at 12:02 am #2935Hi Stephen,
I have to use the selected region to call a GSS service.
How can I do it from the scriptlet ?
Thank you
Sabina
SPARK SupportOctober 26, 2016 at 7:50 am #2942Hi Sabina
Are you trying to use the GSS to provide the data for the data points on the Drill Down Chart?
Regards,
Stephen P.
SPARK SupportOctober 27, 2016 at 7:58 am #2952Hi Sabina,
The GSS service must contain script to return that data from either a file or a database. That script needs to be copied to the Service Call, and the resulting data needs to be formatted programmatically to fit the requirements of the data points.
I looked in the TWX that you sent to see if I could find your GSS to demonstrate, but it is not contained within this TWX.
Region is passed to the JS file by the variable in “DrillDownDB.getPopulationByProvince(region);”.
This snippet of code is manually building the array to form the data points:
if (region == “Lombardia”) {
var pr = [“Milano”, “Bergamo”, “Brescia”, “Como”, “Sondrio”, “Varese”, “Mantova”, “Pavia”, “Cremona”,”Lecco”, “Lodi”, “Monza Brianza”];
var ab = [3126825,1108853,1265077,599905,182086,890234,414919,548722,361610,340251,229576,864557];
for (var i = 0; i < pr.length; i++) {
data[i] = [pr[i],ab[i]];
}However, if you were retreiving from a database, you would need to select the data into a format that can be looped through and populated into the data variable as does the above. If you can create a script that returns “data” in the same format, the subsequent “populateDataSeries(data);” in the Drill Down Tree Implementation code on line 25 will work.
Regards,
Stephen P.
-
|
You must be logged in to reply to this topic.