rdlc background color bug - large expression seems to cause a bug - asp.net

I am working on designing a rather large rdlc report in ASP.Net MS visual 2010. Some rows in the report require the row to be highlighted if something is out of place. So I went to the background colors tab in the Properties box of my rdlc report after clicking on the table row. I am trying to get the following expression to work in the background color tab in the properties box.
`=IiF((Fields!C.Value < .75 And Fields!C.Value <> "")
Or (Fields!S.Value < .75 And Fields!S.Value <> "")
Or (Fields!O.Value > 5), "Yellow", "White")`
Originally I want the background color either yellow or white, but for testing purposes I changed white to green since white is a default it seems.
`=IiF((Fields!C.Value < .75 And Fields!C.Value <> "")
Or (Fields!S.Value < .75 And Fields!S.Value <> "")
Or (Fields!O.Value > 5), "Yellow", "Green")`
This caused some rows to be green, but none were yellow, the rows that should be yellow are instead white.
It works fine when I shorten it to
`=IiF((Fields!C.Value < .75 ), "Yellow", "Green")`
I get all Green and Yellow rows.
And it worked fine when I tried
`=IiF((Fields!C.Value < .75 And Fields!C.Value <> ""), "Yellow", "Green")
This worked fine too I get all rows being either Green or Yellow.
But as soon as I add an Or they stop working.
`=IiF((Fields!C.Value < .75 And Fields!C.Value <> "")
Or Fields!O.Value > 5 , "Yellow", "Green")`
This results in some Green rows but no yellow rows, the should be yellow rows all come out white?
And in some cases I get no Green or Yellow rows. I tired in versing the original statement,
`IiF((Fields!Cpk_C.Value >= .75 Or Fields!Cpk_C.Value = "")
And (Fields!Cpk_S.Value >= .75 Or Fields!Cpk_S.Value = "")
And (Fields!Cpk_S.Value <= 5), "Green", "Yellow")`
but then nothing works as it's all white rows.
Any help in what I am doing wrong, or why this doesn't work, is appreciated, thanks.

As shown in the comments above the problem was solved (thanks to a tip from Ic). The issue had to do with the type of values the items C.Value and S.Value. They were Decimal based and not string so a comparison to <> "" was causing a format warning which wouldn't execute the code on those rows resulting a no color applied as a result. Since they were essentially floats the IsNumeric function was a better fit.
=IiF((Fields!Cpk_C.Value > .75 And IsNumeric(Fields!Cpk_C.Value)) Or (Fields!Cpk_S.Value > .75 And IsNumeric(Fields!Cpk_S.Value)) Or Fields!OOC.Value > 5, "Yellow", "White")

Related

Streamlit bar chart conditional and background color

I have the following code that display streamlit bar chart for one of our job. How do I display RED for error and GREEN for success ?. Each run tell us how long it took in mins and whether it is successful or not. 'S' = Success, 'F' = Fail. As you can see, i only able to show all color green. How do i use alt.condition to switch between bar color.
Second question is to how do I set the graph background to WHITE color not following the body background color which is now in lightgray ?
df = pd.DataFrame({
'runid': ['983232','98324', '1032019', '1042019',
'1052019','1062019', '1072019', '1082019',
'1092019','10102019', '10112019', '10122019',
'10132019','10142019', '10152019', '10162019'],
'duration': [5, 30, 3, 10,3.4,6,12,6,3,6,3,1,5,4.3,4,3],
'results': ['S','S','S','S','S','S','S','S','S','F','S','S','F','S','S','S']
})
c = alt.Chart(df).mark_bar().encode(
x='runid', y='duration', tooltip=['runid', 'duration'],
color=alt.value('#32a852'))
st.altair_chart(c, use_container_width=True)
You can try this:
df = pd.DataFrame({
'runid': ['983232','98324', '1032019', '1042019',
'1052019','1062019', '1072019', '1082019',
'1092019','10102019', '10112019', '10122019',
'10132019','10142019', '10152019', '10162019'],
'duration': [5, 30, 3, 10,3.4,6,12,6,3,6,3,1,5,4.3,4,3],
'results': ['S','S','S','S','S','S','S','S','S','F','S','S','F','S','S','S']
})
c = alt.Chart(df).mark_bar().encode(x='runid', y='duration', tooltip=['runid', 'duration'],
color=alt.condition(
alt.datum.results == "S",
alt.value("#32a852"),
alt.value("red")
)).configure(background='#FFFFFF')
st.altair_chart(c, use_container_width=True)

Kusto - Conditional formating in Kusto

I have a Kusto Query where the result is in the table format. But when I apply the conditional format it does not highlight the cell with the correct color as per the rule I created.
for example--I have a column with duraion and set the rule as below
Green if > 0
Blue if > 1
Yellow if > 5
Red if > 20
But I see some of the cell that has value 2.5 is highlighted in Red . where the color should be blue. When I delete the rule for Red, the cell changes to Yellow color. Is there a solution for this or right way to apply rule.Thanks. This is projecting a wrong alert. Thanks for any inputs.
Screenshot of column with formating
some of the values are in red which should be in blue as per the rules (refer screenshot below)
You can see the rules below
datatable (AvgDuration: string, AvgDurationWin: string, AvgDurationLinux: string, MinDuration: string, MaxDuration: string) [
"0.0666 s","0.0732 s","0.0525 s","0.015 s","0.684 s",
"0.0663 s","0.0712 s","0.0535 s","0.015 s","0.851 s",
"0.0649 s","0.0700 s","0.0521 s","0.014 s","0.674 s",
"25.050 s","17.614 s","18.428 s","13.133 s","56.284 s",
"0.0982 s","0.1074 s","0.0805 s","0.021 s","1.078 s",
"0.0982 s","0.1046 s","0.0814 s","0.021 s","1.041 s",
"0.0982 s","0.1058 s","0.0813 s","0.021 s","1.106 s",
"0.0987 s","0.1089 s","0.0814 s","0.022 s","1.039 s",
"0.0992 s","0.1074 s","0.0817 s","0.022 s","1.032 s"
]
This is because your values are string. If you want to calculate it by seconds and have conditional formatting you can do the following:
Use the round() function to limit the number of digits after the dot
Indicate the unit in the column name
For example:
| summarize AvgDurationInSeconds = avgif round((Duration, Tests == "Success"), 2)

Decimals (involuntarily) trimmed from values when loaded into environment

I'm working with R 3.6.1 in Rstudio 1.2.1335.
When I assign the following value from a column in my data frame, the values that have decimals in that column in the dataframe, get trimmed in the value I assign:
Dataframe$Column1 has values [368.121 376.436]
Value <-- Dataframe$Column1
And I run my code chunk;
The environment shows the column values as: Value num [1:2] 368 376
My decimals have gone and I need those. Why does this happen and is there a way to fix it?
EDIT:
Set_1.
380.283 332.108 327.405 371.570 325.832 345.583 396.377 367.020 428.980 389.524 379.597 407.483 456.271 312.084 391.198 345.813 406.229 346.450 459.307 392.321 337.638 429.377 353.705 377.512 384.921 346.471 411.855 368.406 386.921 397.797 322.416 412.042 383.240 381.244 440.021 372.444 399.301 345.395 359.865 355.449 314.270 453.173 329.055 299.674 351.675 324.334 425.205 437.013 513.334 436.452 335.658 422.669 300.030 287.893 380.611 297.890 351.203 317.065 350.824 269.149 389.509 467.375 399.065 354.954 465.086 353.615 336.454 372.067 424.167 389.172 357.799 321.663 353.633 388.465 342.489 353.487 398.721 416.194 383.376 355.553 398.667 339.722 316.240 383.894 453.429 351.443 460.038 348.860 304.085 258.921
264.107 241.861 278.548 455.216 393.201 348.211 359.426 427.194 391.599 381.335 340.558 369.617 351.342 318.718 338.960 386.547 388.872 283.943 340.501
Set_2:
380.603 332.100 327.391 371.540 325.826 345.602 396.386 367.029 428.949 389.545 379.584 407.454 456.276 312.093 391.414 345.861 406.235 346.259 459.284 392.334 337.626 429.283 353.539 377.568 384.941 346.491 411.820 368.253 386.816 397.723 322.337 412.020 383.158 381.331 440.066 372.361 399.210 345.438 359.948 355.425 314.271 453.169 328.751 299.701 351.388 324.371 425.219 436.906 513.384 436.475 335.508 422.661 300.036 287.908 380.453 297.306 351.275 317.206 351.165 269.122 389.499 467.402 399.136 354.943 465.057 353.593 336.549 372.079 424.062 389.119 357.753 321.758 353.650 388.599 342.285 353.507 398.682 416.289 383.309 355.456 398.816 339.681 316.273 383.898 453.418 351.395 460.027 348.731 304.111 258.452
264.298 241.829 278.297 455.104 393.228 348.117 359.645 427.096 391.526 381.260 340.474 369.791 351.061 318.780 338.949 386.458 389.030 284.093 340.512
Code:
plot(Set_1,Set_2,col = "red", xlab="Set_1", ylab = "Set_2",
main = "Comparison Set_1 and Set_2", type = 'p')
abline(fit5<-lm(Set_2~Set_1), col="blue")
r5<-round(summary(fit5)$adj.r.square, 4)
text(410,330, paste("R2=",r5))
The decimals aren't gone, they are just not shown in your enviroment. Try accessing the values by Value[1]. This clearly gives you your desired result 368.121.

The qnum doesn't show on the Word document

I need to print a test with 3 parts to a Word document. Part 1-question 1 to question 56. Part2-question 57 to question 66; Part3-question 67-question 100. Part 1 and Part 2 questions are required to be on two columns on paper. For example, questions appear on the first page are following.
1. 7.
2. 8.
3. 9.
4. 10.
5. 11.
6. 12.
I have created code behind and the report PT.rdlc. All questions are showed up nicely on the Word doc except some of the question numbers are dropped off. I can't figure out why. Here are some my codes:
int TRow = Dt.Rows.Count; //TRow = number of rows in Part1 or Part2
for (int RowCount = 0; RowCount < TRow; RowCount++)
{
TDt.Rows.Add(1);
if (RowCount < TRow)
TDt.Rows[TDt.Rows.Count - 1]["ID"] = Dt.Rows[RowCount]["qnum"]; //q1
if RowCount + 6 < TRow
TDt.Rows[TDt.Rows.Count - 1]["TID"] = Dt.Rows[RowCount + 6]["qnum"]; //q7
....
}
I do the same way above for all questions in Part 1 and 2. In the report, I use expressions as following for question numbers.
=iif(Fields!question.Value<>"",Fields!ID.Value & ". ","") and
=iif(Fields!Tquestion.Value<>"",Fields!TID.Value & ". ","")
Can you please help me to identify what is wrong with some question numbers are dropped off? Thank you in advance.

Calculate percentage fill of progress bar

I am having trouble setting the worrect width of my progress bar image on a userform in Excel VBA.
I have a userform, and on that form is a label, and an image.
The maximum width of the image is 330.
In my loop from 1 to intNumberOfGetRows (in this case 64) I want to update the width property of the image to show progress as each 1000 record chunk of a large recordset is put in an array and written to a csv file.
Here is my code:
For intRecord = 1 To intNumberOfGetRows + 1 ' outer loop
' put the data in an array and print to file
arrContacts = adoRsMailshotAccConData.GetRows(intRows)
With fsOutputFile
For iDx = 0 To UBound(arrContacts, 2)
.WriteLine arrContacts(0, iDx)
Next
'.Close
End With
sMsg = "Number " & intRecord & " of " & intNumberOfGetRows
Application.StatusBar = sMsg
With frmProgress
.lblProgress.Caption = sMsg
.imgProgress.Width = (intRecord / intNumberOfGetRows) * 330
DoEvents
.Repaint
End With
DoEvents
Next
when intRecord is 13, then that should be around 20% of the image filled, which means the width of the image should be 66, so I came up with this:
330 * (intRecord / intNumberOfGetRows * 100) / 100
It looks as though I have forgotten my basic maths theory, so is that the best way?
thanks for any suggestions on how to improve this
Philip
You don't need those 100s in there. You just want your progress to show you have done (in your example) 13/64ths of the total, and the total is 330, so all you need to calculate is 330 * (13/64):
330 * (intRecord / intNumberOfGetRows)

Resources