23 Oct 2023 07:56 AM
Hi,
I'm testing with community-tips-tricks/ep19/ReadMeExecutiveOverview.md at main · dynatrace-perfclinics/community-tips...
I have removed the conversion goals at the top of dashboards because we didn't configured it for all applications (specially for SAP applic it's not usefull).
But now the dashboard gives me empty values even after updating the query. When I check the code I just want as a test add specific application to the view but can't find the way to do this.
I have tried with:
appsList = "\ My Applic \";
Is there a specific config to add value to a variable in the code?
thx!
Solved! Go to Solution.
23 Oct 2023 08:13 AM
Hi,
As far as I can see this dashboard requires you to enter a Conversion Goal. I've also looked in the JSON and I don't know if it wouldn't be simpler to build a new one based on it rather than reworking the current one, as this parameter (Conv Goal) is included in each tile.
R.
23 Oct 2023 08:38 AM
Hi,
Thanks for the answer. Indeed, I'm busy with checking the setup of the dashboard but still not sure why this code is not working.
For example for tile:
import { rumUserSessionsClient } from '@dynatrace-sdk/client-classic-environment-v1';
export default async function () {
const startTime = Date.parse($dt_timeframe_from).toString(); // Get Dashboard Start Time
const endTime = Date.parse($dt_timeframe_to).toString(); // Get Dashboard End Time
const startShiftTime = startTime-(86400000*$TimeShift); // Get TimeShift variable, convert to days and create startShift
const endShiftTime = endTime-(86400000*$TimeShift); // Get TimeShift variable, convert to days and create endShift
var appsList = "\""+$AppName[0]+"\"";
let i = 1;
// Build Apps List
while (i < 10) {
if ($AppName[i]==null) break;
appsList = appsList+",\""+$AppName[i]+"\"";
i++;
}
appsList = "\""+B2C Mobile Production+"\"";
// Create the USQL query string using the values above
const query = 'SELECT CONDITION (count(*),WHERE starttime>='+startTime+' and endtime<='+endTime+'), CONDITION (count(*),WHERE starttime>='+startShiftTime+' and endtime<='+endShiftTime+') from usersession where useraction.application in ('+appsList+')';
// Fire off the USQL query and get the results
const result = await rumUserSessionsClient.getUsqlResultAsTable({query: query, startTimestamp: startShiftTime, endTimestamp: endTime});
var str1 = (result["values"][0][0]-result["values"][0][1]);
if ((result["values"][0][0])>(result["values"][0][1]))
return result["values"][0][0]+" ("+(str1)+" ↗️🟢)";
else if ((result["values"][0][0])<(result["values"][0][1]))
return result["values"][0][0]+" ("+(str1)*(-1)+" ↘️🔴)";
else
return result["values"][0][0]+" ("+(str1)+" =🟡)";
}
I want to test with hard-coded one applic so I put appList to
appsList = "\""my applic"\"";
but error. The interface gives error but no more info about the error or what it's expected.
Any idea?
24 Oct 2023 09:07 AM
Hi,
I'm a step futher, but still have issue to map the variable in the query string:
var appsList = "\""My Application"\"";
// Create the USQL query string using the values above
const query = 'SELECT CONDITION (count(*),WHERE starttime>='+startTime+' and endtime<='+endTime+'), CONDITION (count(*),WHERE starttime>='+startShiftTime+' and endtime<='+endShiftTime+') from usersession where useraction.application = ('+appsList+')';
This is not working. Any Idea? There is also no information about the error in the UI. Can I find some more details about the error ?
thx!
24 Oct 2023 01:23 PM
I have found the solution:
var app = $AppName
// Create the USQL query string using the values above
const query = 'SELECT CONDITION (count(*),WHERE starttime>='+startTime+' and endtime<='+endTime+'), CONDITION (count(*),WHERE starttime>='+startShiftTime+' and endtime<='+endShiftTime+') from usersession where useraction.application="'+app+'" ';
24 Oct 2023 01:36 PM
Wow great! Good to know 🙏