Count Distinct on Incident_Metric -> Number column

brandimore
Kilo Expert

Hello

I would like to count distinct on the Number column in this table. Unfortunately it's not an option when I go to review the list of Aggregates. I saw another post about creating a new Indicator and Source for this to work. This seems like a lot of work for something this simple, but I did this anyways. When I'm in my report it's not an option to select.

I want to make sure that I'm not making more work for something. Can someone confirm how you can make a new field as an option to Aggregate?

Thanks

Instanbul is the version I'm running. We do have PA also.

find_real_file.png

1 ACCEPTED SOLUTION

gr.reference_field = 'mi_field_value';


View solution in original post

21 REPLIES 21

The Metric Instance table, does contain a field with the sys_id of the assignment group: mi_field_value.


Because the fact this field is not a Reference to Group, you can not pick it.



find_real_file.png


A bit of an undocumented / not recommended way would be to update the value using a background script:


var sysID = 'sysid of new record';


var gr = new GlideRecord('sys_ui_hp_reference');


if (gr.get(sysID)) {


  gr.reference_field = 'mi_field_value';


  gr.setWorkflow(false);


  gr.update();


}



I have tested this on my instance:


find_real_file.png


Thanks Arnoud!


So the Interactive filter Assignment Group is mapped to the "Value" field? IF so, amazing.


I am VERY new to this. Can you point me in the right direction in adding the undocumented script?   And why wold it not be recommended? Just curious.


Thanks very much for your help.


Start with:


- Open a extra background script window in a new tab and past the script in it. (Admin rights required)


- Create a "placeholder Filter refrence" to assignment group and copy sys id of new record



find_real_file.png



- Copy and place the sysid in the script window and execute it


find_real_file.png



- After this the refernce should be updated and the Interactive filter ready to use.


find_real_file.png



Reason to be careful is, is that you need to do some scripting, so you need to know what your doing...


Thanks very much for the details. I'm going to take a look at our DEV environment and try this out today.


Sorry to ask such a junior question, but where do you go to add the background script window? I am an admin I'm just not sure where you do this. Thank you.