- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 05:21 PM
I freely admit to begging for help from the mighty ctomasi and/or anyone else who can help
I have an email script that, in the approval email, displays the name and approver of dashboards selected in our Qlik Dashboard Access catalog item. It works fine, but the business has asked for the results to be sorted by approver to make it easier for the approvers to see all the dashboards they are responsible for. Here's my working script without any kind of sort.:
which produces output like this:
Based on this article by Steve Bell, here is m
Image of my attempt that isn't working:
In case anyone is wondering why I am using images instead of pasting code it's because something in the code keeps breaking the form here, sending it into an endless loop where it says an error prevents saving .
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 09:31 AM
ahhhh I see what's going on hahaha
change this section:
var qlikBoards = current.sysapproval.variables.qlik_db.toString();
var db = new GlideRecord('u_qlik_dashboards');
db.addEncodedQuery("sys_idIN"+ qlikBoards );
db.orderBy('u_business_owner');
db.query();
while (db.next()) {
htmlContent += '<tr><td class="table_content" width="45%" align="left">' + db.u_name.getDisplayValue() + '</td><td width="45%" class="table_content" align="left">' + db.u_business_owner.getDisplayValue() +'</td></tr>';
}
this should also improve performance of the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 06:15 PM
I believe you have error in your 2nd script. from the line
tmpObj.dbName=task.getDisplayValue.....
you have no task variable, should be db.
tmpObj.dbName=db.getDisplayValue..... so on, replace all tasks with db
and also did you declare taskObjList variable? I can't seem to see your declaration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 06:18 PM
I would think your original code would suffice just drop in:
db.orderBy('u_business_owner');
after your addQuery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 06:20 PM
This will sort your query results by the "u_business_owner" field which I am guessing is your approvers? so when you iterate through your GlideRecord object it will already be sorted instead of having to store the information in a variable and sort it yourself.
please use this link quick as the wiki will be retiring on Dec 10th!!!! RIP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 06:35 PM
will
db.orderBy('u_business_owner');
order it by sys_id or by the name of the owner?
I also want to know if orderby can be used to sort the name.