How to use signalfx `publish` based on a dashboard variable - data-analysis

I've got a signalfx query and I'd like to display the timeshift based on a dashboard variable. Is it possible?
A = data('some.count', rollup='sum', extrapolation='zero').sum().publish(label='Request Count')
I was hoping to find a if/else or a parameter to be passed on to the publish function.

Related

Query Google Admin User directory comparing parameters

I'm trying to filter my users list by comparing two parameters
query="EmployeeData.EmployeeID=externalId"
EmployeeData.EmployeeID is a custom schema that is populated, with a cron job, with the same value as externalId.
Of course I let the cron do the field copy only if necessary, this is the reason I'm trying to filtering the users list.
In the way i wrote seems that the query trying to looking for a value "externalId" into the EmployeeData.EmployeeID ignoring that "externalId" is a even a field
any suggestion?
The way your code is written, the query sent to Google's servers is as you correctly guessed the following:
EmployeeData.EmployeeID=externalId where your actual externalId is not sent but rather the string "externalId".
To replace this string for the actual value of your variable, you can use what is called "string concatenation" 1. To do it, you just need to modify your code as shown below:
query="EmployeeData.EmployeeID=" + externalId;
This way, the query will be sent as you need to Google's servers.

HTML url passing multiple parameters

I'm trying to pass multiple parameters with an url. I have checked out almost every topic about it, but can't seem to find an answer. I have tried different ways, but it still doesn't work.
It is only sending the first parameter.
If I start with post_id - I can't get comment_id
If I start with comment_id - I can' get post_id
My idea of url:
http://localhost/index.php?post_id=3&comment_id=6
OR
http://localhost/index.php?post_id=3&comment_id=6
I try to use it later like this:
else if(isset($_GET['post_id']) & isset($_GET['comment_id'])){
$post_id = $_GET['post_id'];
$comment_id = $_GET['comment_id'];
$user_id = $this->UserModel->getUser();
$BlogPost = $this->BlogModel->getBlogPost($post_id);
$BlogComments = $this->BlogModel->getBlogCommentList($post_id);
$BlogComments = $this->BlogModel->deleteBlogComment($comment_id,$user_id);
include 'views/ViewBlogPost.php';
}
Your below URL Structure is perfactly true
http://localhost/index.php?post_id=3&comment_id=6
Logic to Pass data Through URL in your script is called as QueryString Which you can build in below way
NAME=VALUE - this is called Name Value Pair , you can Pass Multiple Name Value pair by appending with '&' only
e.g.
http://localhost/index.php?name_1=value_1&name_2=value_2
on server side you will retrive them by using GLOBAL $_GET e.g print_r($_GET); to view all the passed data.
individually you can access them by using
echo $_GET['name_1']; echo $_GET['name_2'];
Also i suggest you to check your GPSC setting in your php.ini to define the priorities between your Super Globals.

Getting the value of a particular cell with AJAX

My goal is very simple and I would guess it is a very common goal among web developers.
I am creating a Rails (5.1) application, and I simply want to use AJAX to get the value of a specific cell in a specific row of a specific table in my database (later I am going to use that value to highlight some text on the current page in the user's browser).
I have not been able to find any documentation online explaining how to do this. As I said, it seems like a basic task to ask of jquery and ajax, so I'm confused as to why I'm having so much trouble figuring it out.
For concreteness, say I have a table called 'animals', and I want to get the value of the column 'species' for the animal with 'id' = 99.
How can I construct an AJAX call to query the database for the value of 'species' for the 'animal' with 'id' = 99 .
Though some DBs provide a REST API, what we commonly do is define a route in the app to pull and return data from the DB.
So:
Add a route
Add a controller/action for that route
In that action, fetch the data from the DB and render it in your preferred format
On the client-side, make the AJAX call to that controller/action and do something with the response.

When syncing my model within Invantive Control for Excel I get the error "Could not find parameter with name 'P_SCHEME_CODE'

When I try to synchronise my model retrieving GL Account Classification information from Exact Online, I get the following error:
itgensdf031: Could not find parameter with name 'P_SCHEME_CODE':
What should I change in order for this to work?
Related SQL query on Exact Online table GLAccountClassifications:
select division_code
, glclassification_code_attr
, glaccount_code_attr
from glaccountclassifications
where glaccountscheme_code_attr = :P_SCHEME_CODE
order
by glaccount_code_attr
, division_code
The query listed uses :P_SCHEME_CODE. For SQL this would work, but Invantive Control parses the query early to retrieve the list of fields from the metadata. It needs to know the parameters and find values for them in the Invantive Control list of parameters as defined in the Model Editor under "Parameters" in the tree.
In Invantive Control to use a parameter in a query you will need to use $P{P_SCHEME_CODE} instead of :P_SCHEME_CODE.
$P{P_SCHEME_CODE} can be inserted in a query by hand or by using Building Blocks drop down and then choosing a previously defined parameter.

Custom code in Reporting Services report

In Reporting Services I would like to add a parameter that contains data from a custom code block. Ideally, I would be able to run the following code (this is a simple testing example):
Function GetPeriods() As String()
Dim values As System.Collections.ArrayList =
New System.Collections.ArrayList()
For i as integer = 1 to 24
values.Add(i)
Next
Return values.ToArray()
End Function
and put the following in the "Text Field" of the parameter:
=Code.GetPeriods()
However, when I run the report, the parameter I apply this to is disabled and empty. Is there a different technique that should be used? Or am I doing something wrong?
If you're using SQL 2008 Reporting Services then you can have a look at this page which introduces the concept of using custom assemblies.
If you're using SQL 2005 Reporting Services then this link is the one you want.
It's a mostly trivial thing, simply compile your code into a class library and follow the instructions provided to allow your report to reference it.
You are returning an array item (an array of strings) into a text field. Instead, try returning a plain string. That should work. If you would still like to return an array list, you must basically bind it to a list control in your RDL. You can definitely do that with dataset extensions. However, I am not sure if there is any other easy way. Check the proprties of the list control and see if it allows you to directly bind to an array list.
You can create the same stored procedure on SQL Server and load parameter values from that procedure.
To access your members/functions implemented in custom code of SSRS report you should set the access modifier to "Public":
Public Function GetPeriods() As String
...
see article Writing Custom Code in SQL Server Reporting Services
I've been trying to do this same thing, set a simple list of parameter values from report code. None of the links in any of these answers shows how to do this and after quite a bit of digging around I don't think it's even possible. Yes it is possible to get the values from a database query, from a web service, or from a custom assembly, but each of these creates a lot of overhead compared to getting the list from a simple function call like =Code.GetValues(), where the function uses a For loop to create the values.
msvcyc is correct in pointing out that the parameter is expecting a string value, but the function is returning an array. I changed the return type to Array as suggested by prashant sable, but the select list is still grayed out, it does not work. And coldice is correct in saying that the access modifier should be Public.
In my digging around I found an article by James Kovac from 2005 that pointed out why this is not possible. The Parameters class has a get method, but no set method. In the VS 2008 object browser for SSRS 2008 the object name has changed, but it still does not contain a set method (see Microsoft.ReportingServices.Interfaces.IParameter.Name or .Value).
My current workaround is to just hard code the list of values, but if your value list needs to be dynamic then your only choices are database queries, web services, or custom assemblies. I think the easiest workaround of these three is to get the values from the database engine, as suggested by oleksiy.t, as long as you can write a query to return the value list you want. Your list of integers, or my list of time intervals, would both be easy queries to write. Otherwise you will need to use one of the other two workarounds.
I checked your code. The only thing that's wrong is your function returns String(). When I changed your method signature to return Array, it worked fine, in my report.
Change the signature to Function GetPeriods() As Array
Everything I've seen requires parameters and their respective settings to be part of the RDL.
That being said, if you're going to "hardcode" the values, you could create a dataset just for the report, perhaps in XML, or if it needs to be programmatically driven, do it in a web service.