grafana dynamic variable use - grafana

suppose i want to change the color of the panel text based on a logic for example if
active users are 3 and open issue is 6 then since we 2 issue per person color should be yellow and if open issue becomes 9 then then based on active user color should be red
yellow=active user2
red= active user3
how can i implement it
using variables and i am using prompetheus as data source
and metrice for active user is
active_users{users="activeusers"}
Open issue metice
redmine_project_open_issues_total_count{projectname="Redmine Dashboard"}

Related

Visio: Creating Automatic Numbered Label

I'm currently working on creating a new stencil for several components I use in Visio and I'm stuck at the point of providing proper labels. If you use a resistor from Visio stencil it automatically generates a label "R1" (for first resistor) and "Rk" for the kth resistor. How can I do something similar for my own stencil ?
1- I need to generate a label "ABCD #" (# number automatically generated based on instance count)
2- How can I position the location of this field?
PS:
1- Visio components have a custom defined field which allows for this (which I don't know how to create)
2- For capacitor for example the shapesheet shows an interesting entry
=SETF(GetRef(User.Label),"""C""&"&ThePage!User.AccumulatorCount)&SETF(GetRef(ThePage!User.AccumulatorCount),ThePage!User.AccumulatorCount+1)
which supposedly is how the count and name are generated (I'm not sure how the AccumulatorCount is defined it differs from element to element).
Thank You!
The EventDrop ShapeSheet cells for various electrical shapes have formulas similar to the one you have discovered:
SETF(GetRef(User.Label),"""C""&"&ThePage!User.AccumulatorCount)&SETF(GetRef(ThePage!User.AccumulatorCount),ThePage!User.AccumulatorCount+1)
The ShapeSheet for the page has a cell: User.AccumulatorCount for capacitors. Other User cells will be added as other shapes are dropped. You can set up your own system by adding a User cell to the page, say: User.Widget. Then you place the "Widget" version of the "SETF" formula into your own shapes.
You can create user cells by:
Open the ShapeSheet for the Page (right-click blank area of page, Show ShapeSheet)
Right-click in ShapeSheet and choose Add Section
Add a User-defined cells section
Find the User-defined cells section and similarly add rows to it via
right-clicking
You change the row names by typing over the red, row-name text on the left.
You enter values and formulas in the cells as you would in Excel.
You can toggle viewing formulas vs. viewing values by pressing F5
while in the ShapeSheet.
You have to make the User cell in the page first, so that your shape can reference it. Once your shape references the page cell, you can drag your shape into a stencil, and it will "drag the page User cell along too". So now, you can drop your Widget shape into a new document, and it will create the page User cell on the fly.
The system is basic and fragile. The count only goes up, and never down. If you have shapes with 1, 2, 3, 4 and you delete 1 and 2, the next shape will still be 5.

Putting a percentage to put in a form control

I've got an access database which we use to book web advertising against a forecast/inventory limit.
I have three unbound text boxes which work out three things from the continuous form it sits below:
Impressions[txtImpressions]: =IIf(IsNull(Sum([Impressions]))=True,0,Sum([Impressions]))
Forecast[txtForecast]: (Populated on form load by vba)
Remaining Availability[txtDifference]: =[txtForecast]-[txtImpressions]
I would like one more box, which shows the impressions as a percentage of the forecast, so if txtImpressions contains 200 and txtForecast contains 400, I'd like the percentage box to show '50%'
I've tried =[txtForecast]/[txtImpressions] to at least divide it, but it always give me a value of 1. I've tried
=Format([txtForecast]/[txtImpressions]), Percent))
but that doesn't help either.
Can anyone help?
Set Format property of textbox with percentage to Percent (in Form designer)
You see always "1" if Decimal Places of your text box is set to 0.
Comtrol Source property of this text box should be =[txtForecast]/[txtImpressions]

Nintex Forms 2010 - How to set a rule with multiple checkbox options

I have a Nintex form and one field has 5 checkboxes where the user can make multiple selections:
Please select all that apply: [] red [] blue [] green [] yellow [] purple
If the user makes any selection that contains "purple" then i want another field to show asking for additional information.
I currently have my question field in a panel and this is the current rule for that panel:
not(Colors == "purple")
Right now it works but only when "purple" is the only selection. I need a statement that says -- Only show if Colors[the checkbox field] equals any combination of choices containing purple.
What's the correct syntax to use?
!inArray(Colors,"Purple")
SharePoint puts multiple selection in an array. Just add this rule to each control and change "Purple" to your other choices.
Here is an example of a rule, if you want one control be selected if one of the two colors are selected.
!inArray(Colors,"Purple") || inArray(Colors,"Red")

how to hide and unhide authoerable tabs depending upon value selected from a drop down in CQ5

i am trying to create a footer component in CQ5, where i have 4 columns & all are autherable.
But we have to make no of columns autherable too i.e based on a value selected form a dropdown we have to open those many tabs for authoring those many columns only.
i have created a dropdown and have a maximum range of 6 columns. i know that i have to configure a listener for this purpose but don't know how . Requirement is like if i select 3 from the drop down then 3 tabs should come to author 3 columns
pls help me , i am middle of something very important.i need the solution very early too as i have to finish the job as soon as possible
I might be late for this by now but in case you still need it:
You need to add a listener node before closing your drop-down element:
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(box){ //here you also need to handle the hide/unhide when the panel loads for the first time. Use this.getValue() to retrive the intial value }"
selectionchanged="function(box, value) {
for(var c=1;c<=value;c++){
this.findParentByType('tabpanel').unhideTabStripItem("tab"+c); // You need to handle the opposite with hideTabStripItem("tab"+c);
}
}"/>
Then on both "loadcontent" and "selectionchange" (these are events on your drop-down) grab the current selected value and use it to hide/unhide the tabs. In this case the tabs would be named "tab1", "tab2", etc, make sure you get the names right.
The ExtJS in the events is finding the "tabpanel" container for the whole dialog, and then hiding/unhiding based on name. You could also set to enable/disable using the methods ".enable()" and ".setDisabled(true)". Just make sure you get the reference to the tab first if you want to do this (something like ".getComponent(tabName).enable()").
I didn't test this specific code, I couldn't find my actual example from my code base but this should take you in the right direction.

Separating multiple items from user input

I want my user to enter an arbitrarily long list of items and then separate them behind the scenes into a format that I can easily store in my database. I have two thoughts on how to do this, but only one that I can get to work (the less elegant version).
Thought 1 (this is the one I can get to work): Provide user with a UITextView and have them enter items separated by a special character, ; for example. When they submit the form I parse it out with regex and then store accordingly. This is not as elegant from a UI/UX standpoint as I'd like, but I can make this one work.
Thought 2 (this is what I think would be better): Provide a UITextField with a + button by it. User enters 1 item and then clicks the + button to make another UITextField appear. If more than 1 textfield is on screen they each gain a - button to "delete" that field. Any ideas on how I could go about doing this?
Thanks!
Look at the Xcode template for master/detail on the iPhone.
It has a table view into which you can add new rows by pressing the + button top right. In this case each row is a default tableViewCell, but you could easily modify to add a UITextField
Option 2 sounds like it would be pretty easy with a UITableView. You could have a text field above it so that you do not have to show a new view to enter data. Then just clear the text field once they have entered the data. You could use swipe to delete on the table to delete entries.
/-----------------\
|Prompt text | + |
|------------------
| User entry 1 |
| User entry 2 |
| User entry 3 |
| User entry 4 |
| |
\-----------------/
Another way to implement option 1 is TITokenField. It allows the user to type until they press the token delimeter key (',' by default I think). At this point a token is created based on the text the user entered.
There are various call backs that can be used with it, so that you can validate their input before the token is created. Processing the list of items the user entered is then as simple as iterating over an array of tokens. Bonus feature: TITokenField can work with data sources as an autocomplete. The demo app shows something very similar to what you are describing, with a plus button to add a new token. Tokens can be deleted by selecting them then pressing backspace.