I’m trying to use conditional formatting for a fill color in a table cell in a report. The statement I’m using is:
IIF (GETDATE() >= (DATEADD(day, 25, B6CONDIT.B1_CON_ISS_DD)) AND (GETDATE () <= (DATEADD(day, 30, B6CONDIT.B1_CON_ISS_DD)), "Yellow", "White"))
I'm getting an error when I try to apply it to my table that says:
"IIF (GETDATE() >= (DATEADD(day, 25, B6CONDIT.B1_CON_ISS_DD)) AND (GETDATE () <= (DATEADD(day, 30, B6CONDIT.B1_CON_ISS_DD)), "Yellow", "White")) is not valid color."
What am I doing wrong?
Thanks!
Phil R
I've made sure that my parentheses are matched and I know that Yellow and White are valid colors.
If my condition is true and plot a label to the chart but it should become false if the next bars high is higher then the high of the bar where the condition is true.
the condtion should plot a label if bear is true, but when the next bar is higher it should delete the label. Also I want that the label, if its true it will be true for 5 candles and in this period it shouldn't plot another label. the (for i = 1 to 4) is working but it calculates from the wrong bar because the script didn't delete the false bar label that became untrue.
bearlabel = if bear == true
myLabel1 = label.new(x=bar_index, y=high, color=color.rgb(255, 82, 82, 49), text= "S", textcolor=color.white, style=label.style_label_down, size=size.tiny)
if bear[1] == true and high[1] < high
label.delete(bearlabel)
for i = 1 to 4
if bear[i] == true
label.delete(bearlabel)
If I use bear1 I think it takes the wrong label. So how can I get the high of the conditions Bar to check if the new high is higher?
if bear[1] == true and high[1] < high
label.delete(bearlabel)
To delete a label, you must use the name of this label.
here in your code the label name is myLabel1 :
myLabel1 = label.new(x=bar_index, y=high, color=color.rgb(255, 82, 82, 49), text= "S", textcolor=color.white, style=label.style_label_down, size=size.tiny)
So you must use myLabel1 to delete it :
label.delete(myLabel1)
The chart appears with dark background, axis numeric labels in grid positions are yellow.
How do I change axis label colors to white?
E.g. in this example https://www.arction.com/lightningchart-js-interactive-examples/#edit/lcjs_example_0001_simpleScatter
I'm trying
chart.getDefaultAxisX()
.setInterval(0, 92 * dataFrequency)
.setTickStyle((visibleTicks) => visibleTicks
.setLabelFillStyle( color: ColorRGBA(255, 255, 255) })
)
But it's giving SyntaxError: Unexpected token, expected ","
According to the documentation it expects you to pass FillStyle, not just color. The solution for your case is as follows:
chart.getDefaultAxisX()
.setInterval(0, 92 * dataFrequency)
.setTickStyle( (visibleTicks) => visibleTicks
.setLabelFillStyle(
new SolidFill( { color: ColorRGBA(255, 255, 255) } )
)
)
Hello I am running the following expression in a textbox and getting the error below. I've used the same expression in other text boxes and it's working fine so am very confused as to why it's not working in this one.
=sum(IIF(Fields!Fieldname1.Value = "A" and Fields!Fieldname2.Value = "Red", Fields!Total.Value, Nothing)) / 1675 * 100 OR =sum(IIF(Fields!Fieldname1.Value = "A" and Fields!fieldname2.Value = "Blue", Fields!Total.Value, Nothing)) / 1702 * 100
The Value expression for the textrun ‘Textbox278.Paragraphs[0].TextRuns[0]’ contains an error: [BC30201] Expression expected.
Ok managed to answer my own question, didn't need the '=' before the 'sum'
=sum(IIF(Fields!Fieldname1.Value = "Red" and Fields!Fieldname2.Value = "Red", Fields!Total.Value, Nothing)) / 1675 * 100 OR sum(IIF(Fields!Fieldname1.Value = "Blue" and Fields!Fieldname2.Value = "Blue", Fields!Total.Value, Nothing)) / 1702 * 100
I am using Handlebar in my Rails 3.2 jquery mobile application.
I am trying to write a switch case statement inside a Coffeescript method like
Handlebars.registerHelper 'status', (blog) ->
switch(parseInt(blog.status))
when [0..20]
status = "active"
when [20..40]
status = "Moderately Active"
when [40..60]
status = "Very Active"
when [60..100]
status = "Hyper Active"
return status
I am not getting any result . How to use range in when . Please suggest
Your switch won't work as Cygal notes in the comments (i.e. see issue 1383). A switch is just a glorified if(a == b) construct and you need to be able to say things like:
a = [1,2,3]
switch a
...
and have it work when you switch on an array. The CoffeeScript designers thought adding a (fragile) special case to handle arrays (which is all [a..b] is) specially wasn't worth it.
You can do it with an if:
Handlebars.registerHelper 'status', (blog) ->
status = parseInt(blog.status, 10)
if 0 <= status <= 20
'Active'
else if 20 < status <= 40
'Moderately Active'
else if 40 < status <= 60
'Very Active'
else if 60 < status <= 100
'Hyper Active'
else
# You need to figure out what to say here
Or with short circuiting returns like this:
Handlebars.registerHelper 'status', (blog) ->
status = parseInt(blog.status, 10)
return 'Something...' if status <= 0
return 'Active' if status <= 20
return 'Moderately Active' if status <= 40
return 'Very Active' if status <= 60
return 'Hyper Active' if status <= 100
return 'Something else' # This return isn't necessary but I like the symmetry
Note that you have three special cases that you need to add strings for:
status < 0.
status > 100.
status is NaN. This case would usually fall under the final "it isn't less than or equal to 100" branch since NaN => n and NaN <= n are both false for all n.
Yes, you're absolutely certain that the status will always fall within the assumed range. On the other hand, the impossible happens all the time software (hence the comp.risks mailing list) and there's no good reason to leave holes that are so easily filled.
Also note the addition of the radix argument to the parseInt call, you wouldn't want a leading zero to make a mess of things. Yes, the radix argument is optional but it really shouldn't be and your fingers should automatically add the , 10 to every parseInt call you make.
Adding a tiny bit to mu is too short's answer, you can transform its second code snippet into a switch expression:
Handlebars.registerHelper 'status', (blog) ->
status = parseInt(blog.status, 10)
switch
when status <= 0 then 'Something...'
when status <= 20 then 'Active'
when status <= 40 then 'Moderately Active'
when status <= 60 then 'Very Active'
when status <= 100 then 'Hyper Active'
else 'Something else'
This is basically equivalent to doing a switch (true) in JavaScript (though the CS compiler will generate a switch (false) statement with the negated conditions to ensure boolean results from the expressions... i think).
And the reason why the switch over ranges doesn't work is that ranges literals in CS represent plain old JS arrays (though the compiler will do some optimization tricks when doing something like for i in [1..something]), so when they are found inside a switch they are treated just like normal array values:
// Generated JS for question's CS code:
switch (parseInt(blog.status)) {
case [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]:
status = "active";
break;
case [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]:
status = "Moderately Active";
break;
case [40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]:
status = "Very Active";
break;
case (function() {
_results = [];
for (_i = 60; _i <= 100; _i++){ _results.push(_i); }
return _results;
}).apply(this):
status = "Hyper Active";
}
The value inside the switch statement is basically compared to each case value using ===, which only works for primitives, not for arrays (and even if it worked for arrays, it would be testing array equality, not if the switched value is contained in the caseed arrays).