Eric,
I have tried as per your suggestions, but I am getting an error like below. The same javascript variable is working in Ajax service call in the service data table. Please let me know, what I am doing wrong here ?
Drill down code - See the highlighted variable
<drilldown-spec><drilldown-spec> <drilldown name="Type"> <js-query description="Quantity Sold by Product Type (Clothing/Appliance/Garden)"> <script> <![CDATA[ var data = [["CLOTHING", 1093], ["APPLIANCES", 174], ["GARDENING", 98], ["FURNITURE", 342], ["PHARMACY", 422]];
var data1 = reportBO.displayRecord("05/16/2020","05/19/2020"); //Example of accessing local variables instead of using the "populateDataSeries" convenience method tw.local.dataSeries.dataPoints = new tw.object.listOf.DataPoint(); for(var i = 0; i < data.length; i++) { tw.local.dataSeries.dataPoints[i] = new tw.object.DataPoint(); tw.local.dataSeries.dataPoints[i].label = data[i].status; tw.local.dataSeries.dataPoints[i].value = data[i].count; //tw.local.dataSeries.dataPoints[i].label = data[i][0]; //tw.local.dataSeries.dataPoints[i].value = data[i][1]; } ]]> </script> </js-query> <drilldown name="Brand" cond-field="../@name" cond-operator="eq" cond-value="CLOTHING"> <js-query description="Quantity Sold of Clothing Products by Brand"> <script> <![CDATA[ var data = [["Brand1", 363], ["Brand2", 556], ["Brand3", 174]]; populateDataSeries(data); ]]> </script> </js-query> <drilldown name="Gender"> <js-query description="Quantity Sold of Clothing products by Brand, Gender"> <in> <field var="brand" ref="../@value"/> </in> <script> <![CDATA[ var data = []; if(brand == "Brand1") { data = [["M", 363]]; } else if(brand == "Brand2") { data = [["M", 382], ["F", 174]]; } else if(brand == "Brand3") { data = [["M", 174]]; } populateDataSeries(data); ]]> </script> </js-query> <drilldown name="Kind"> <js-query description="Quantity Sold of Clothing products by Gender, Brand and for specific Kind"> <in> <field var="brand" ref="../../@value"/> <field var="gender" ref="../@value"/> </in> <script> <![CDATA[ var data = []; if(gender == "M") { if(brand == "Brand1") { data = [["SHIRT", 251], ["PANTS", 112]]; } else if(brand == "Brand2") { data = [["SOCKS", 168], ["SHIRT", 214]]; } else if(brand == "Brand3") { data = [["TIE", 174]]; } } else if(gender == "F") { if(brand == "Brand2") { data = [["SHIRT", 86], ["PANTS", 65], ["DRESS", 23]]; } } populateDataSeries(data); ]]> </script> </js-query> </drilldown> </drilldown> <drilldown name="Kind"> <js-query description="Quantity Sold of Clothing products by Kind and for specific Brand"> <in> <field var="brand" ref="../@value"/> </in> <script> <![CDATA[ var data = []; if(brand == "Brand1") { data = [["SHIRT", 251], ["PANTS", 112]]; } else if(brand == "Brand2") { data = [["SOCKS", 168], ["SHIRT", 300], ["PANTS", 65], ["DRESS", 23]]; } else if(brand == "Brand3") { data = [["TIE", 174]]; } populateDataSeries(data); ]]> </script> </js-query> </drilldown> </drilldown> <drilldown name="Brand" cond-field="../@name" cond-operator="eq" cond-value="APPLIANCES"> <js-query description="Quantity Sold of Appliances by Brand"> <script> <![CDATA[ var data = [["Brand6", 35], ["Brand5", 49], ["Brand7", 17], ["Brand8", 22], ["Brand9", 22], ["Brand4", 29]]; populateDataSeries(data); ]]> </script> </js-query> </drilldown> </drilldown></drilldown-spec>
Error
\"Execute JavaScript\" of \"General System Service\" with name \"Execute Drill-down Query\". Task instance id \"null\". Details: \"Runtime error in script (\"Process: 'Execute Drill-down Query' ProcessItem: 'Execute JavaScript' Type: 'ITEM'\" 87:0). Unknown IBM Business Automation Workflow class ReportBO\nScript (line 87):\nCan not determine line in error. Not enough
------------------------------
Rameshkumar Chandrasekar
------------------------------
Original Message:
Sent: Mon May 18, 2020 06:26 PM
From: Eric Ducos
Subject: BAW Drilldown chart
Ah ok - yes. MediaConsumptionDB is a Javascript object defined in a server-side JS file.
The logic of MediaConsumptionDB.selectTypes() simply calls a BPM service (for example using TWService.execute() or tw.system.executeServiceByName()). This way you can synchronously invoke BPM services from your drill down logic (to make DB queries, external service calls, etc...).
------------------------------
Eric Ducos
Original Message:
Sent: Mon May 18, 2020 05:59 PM
From: Rameshkumar Chandrasekar
Subject: BAW Drilldown chart
Thank you Eric for your reply. I have just gone through the material. But One question, how mediaConsumbtionDB javascript variable is accessed inside the scriptlet(Attached Picture). where the value is being defined (I dont see it in scriptet) ?
It is being used as BPM variables, I am not sure, how do I set the JavaScript variables in the script and access the same in scriptlet in the sequence. Could you please clarify ?
------------------------------
Rameshkumar Chandrasekar
Original Message:
Sent: Mon May 18, 2020 05:21 PM
From: Eric Ducos
Subject: BAW Drilldown chart
Dynamic drill-down behavior for BPM UI charts is definitely possible and not very hard to implement. The most comprehensive reference is at this link (starting p.97/155 - section titled "Reporting and Analytics").
------------------------------
Eric Ducos
Original Message:
Sent: Mon May 18, 2020 04:35 PM
From: Rameshkumar Chandrasekar
Subject: BAW Drilldown chart
Hi All,
Have anybody tried to implement the drill down chart using BPM UI toolkit. As per the documentation stated below, it allows to implement only with static data, not sure how to implement using dynamic data using variables.
Please let me know, if you find a way to implment that ?
https://www.ibm.com/support/knowledgecenter/SS8JB4/com.ibm.wbpm.wle.editor.doc/topics/rbpmui_drilldowntrees.html
------------------------------
Rameshkumar Chandrasekar
------------------------------