Grafana: No value to text mapping - grafana

Like you can see in the following screenshot I am trying to map "no value" to text. What I want to achieve is that in the case of "no value" the text "offline" gets displayed. My guess is that "no value" is not the right parameter to map with, but I have no idea whats the right one. I also tryed NaN which doesnt work to.
I would be really happy if someone can point me to the right value here!

Try null instead of no value.
Also, for your 2nd mapping, you could use range to text. You could use range to text for both your mappings actually..
null - null => offline
1 - 1000 => online
You might need to save dashboard and refresh it to see changes. It did not update for me without a refresh (using an older version though).

Related

Object value is changed before setting it in Unreal Engine 4.27.2

I'm verifying the value of a Text object in Unreal then setting the value after the branch node. However the value is changed before. I managed to isolate the issue and reproduce the bug in that small blueprint (The execution before is just the BeginPlay event attaching the debug interface then leading up here):
The results in the Direction Trace output (Small function that displays the value requested) is always "Up" and the Actual Content shows "New Value".
However, Direction will be "Down" and Actual Content will show the correct original value ("Hazard 3") if I remove the last node that sets "Short Difficulty Name".
Furthermore, if I compare the original value with a random integer like so:
Direction will show "Down" while "Actual Content" still shows "New Value"
I really don't get it, tried copying the value of the Text instead in case it was a pointer issue, reading online if the Branch node or pure functions had a delay, comparing Text instead of String..
I ended up fixing the issue by adding a 0.0001s delay after reading variable and before writing anything, then the values were correct.

Using "is null" when retrieving prices doesn't work

I am trying to get the price items for performance block storage that are generic (not specific to a certain datacenter). I can see that these have the locationGroupId set to blank or null, but I can't seem to get the objectFilter to work with that, the query returns nothing. If I omit the locationGroupId filter I get a result that contain both location-specific and non-location specific prices.
GET /rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":"is null"}}}
I am guessing there is something wrong with the object filter, any ideas?
If I filter on locationGroupId 509 it works:
/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":509}}}
The reason it the first query didn't work while the second did was that I used the command "curl -sg" to do the request. While that eliminates the need to escape the {}[] characters - it also turns off escaping other characters correctly in the URL - like the space in "is null". Changing that to "is%20null" solves the issue.
I am posting this as the answer as I find it likely for others to encounter this problem.

An appearance was requested without a variable text field

I have come across this error while trying to fill in a form field. I really have no idea what it means and only occurs on some of the PDFs that I have.
I found it being thrown from AcroFields.java here:
if (!PdfName.CH.equals(fieldType))
throw new DocumentException("An appearance was requested without a variable text field.");
Could anyone provide insight into this error and what is causing it?
You're using a very old version of iText, please upgrade!
In the most recent version, exceptions are localized:
if (!PdfName.CH.equals(fieldType))
throw new DocumentException(MessageLocalization.getComposedMessage(
"an.appearance.was.requested.without.a.variable.text.field"));
As for your question: the error tells you exactly what is happening. You are setting a value for a field for which two or more appearances are defined. However, the value you've chosen is an invalid value.
For instance: you have a check box for which the possible states are "Off" and "On", but you're trying to set the value "1". There is no appearance defined for the value "1" hence the exception.

Requesting member of node_element results in "undefined"

I'm using Opa for a school project in which there has to be some synchronization of a textfield between several users. The easy way to solve this, is to transmit the complete field whenever there is a change performed by one of the users. The better way is of course to only transmit the changes.
My idea was to use the caret position in the textfield. As a user types, one can get the last typed character based on the caret position (simply the character before the caret). A DOM element has an easy-to-use field for this called selectionStart. I have this small Javascript for this:
document.getElementById('content').selectionStart
which correctly returns 5 if the caret stands at the fifth character in the field. In Opa, I cannot use selectionStart on either a DOM or a dom_element so I thought I'd write a small plugin. The result is this:
##extern-type dom_element
##register jsGetCaretPosition: dom_element -> int
##args(node)
{
return node.selectionStart;
}
This compiles with the opp-builder without any problem and when I put this small line of code in my Opa script:
#pos = %%caret.jsGetCaretPosition%%(Dom.of_selection(Dom.select_id("content")));
that also compiles without problems. However, when I run the script, it always returns "undefined" and I have no idea what I'm doing wrong. I've looked in the API and Dom.of_selection(Dom.select_id("content")) looked like the correct way to get the corresponding dom_element typed data to give to the plugin. The fact that the plugin returns "undefined" seems to suggest that the selected element does not know the member "selectionStart" eventhough my testcode in Javascript suggest otherwise. Anyone can help?
In Opa dom_element are the results of jQuery selection (i.e. an array of dom nodes). So if I well understood your program you should write something like node[0].selectionStart instead of node.selectionStart.
Moreover you should take care of empty selection and selection which doesn't contains textarea node (without selectionStart property). Perhaps the right code is tmp == undefined ? -1 : tmp = node[0].selectionStart == undefined ? -1 : tmp

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.