Assign a color to individual row numbers - ssrs-2008

I am trying to assign an individual color to each row in a group. There are approximately 50 rows I need to assign a color and they all must be unique. What would be the easiest way to do this?
I do not want to do the alternating row colors:
"=IIf(RowNumber("DataSet1") Mod 2 = 1, "White","Blue")",
but if there was a way to modify this expression to do 50 colors and then repeat I'd be okay with that.

you can use choose . otherwise use custom code function
=Choose(ROWNUMBER(nothing) mod 50, "Brown", "Blue", "GoldenRod", "Olive", "MediumTurquoise","Red", "Green", "DeepSkyBlue", "Yellow", "Chocolate", "Purple", "DarkOrange" ,.....)

Related

Ag-grid tree data - trying to expand specific parent node but the node is undefined

I have tree data in ag-grid that is coming in like this:
[{"colorName": "Magenta", parentColor: "Red", "namePath": ["Red", "Magenta"]},
{"colorName": "Pink", parentColor: "Red", "namePath": ["Red", "Pink"]},
{"colorName": "Cerulean", parentColor: "Blue", "namePath": ["Blue", "Cerulean"]},
{"colorName": "Goldenrod", parentColor: "Yellow", "namePath": ["Yellow", "Goldenrod"]}]
The ag-grid ends up with Red, Blue, and Yellow as parent rows, which you can click to expand to reveal the child rows, like Magenta and Pink for Red. Now I am trying to automatically expand a specific parent row upon load. For example, say a user's preferred color is Red, so when the ag-grid loads, I want the Red parent group to be already expanded.
The problem is I have trouble identifying the node programmatically. I tried going through the node data with forEachNode, like:
onFirstDataRendered(params) {
this.gridApi.forEachNode((node) => {
if (node != undefined && node.data != undefined) {
console.log("node: " + JSON.stringify(node.data);
}
});
}
I only get node data from the child rows, like Magenta or Pink. The nodes for the parent rows are undefined. I thought maybe I could access the parent row by going up a row index from the first child row, but I'm unable to figure out how to traverse up a row index and use it to expand the row.
I figured it out. Instead of using node.data, I used node.key. Now I can see the parent row name.

How to get first elements from a pyspark array?

I have an array and I just keep a specific column from it like this in PySpark:
c = [ "green", "blue", "red", "yellow",... ]
And I want to keep the n first elements of this column
How can I do this please ? I know is a simple question but I don't find the solution ...
Thanks

Randomise Multiple Choice options in swift

I hope you are all well!
I am new in Coding and Swift.
I am making a quiz app and there are 2 things I would need help with.
The first one is : I want to randomise the options of the multiple choice answers for each question every time the game is played.
For example, if i define an array to contain the different answer options (the different colours), i want the question to retrieve 3 random answers together with the correct one like so:
let answers = [
"Red",
"Blue",
"Green",
"Yellow",
"Orange",
"Black",
"Grey",
"White"]
Question(q: "What colour is the ocean ?", a: ["Blue", "randomAnswer1", "randomAnswer2","randomAnswer3"], correctAnswer: "Blue"),
Question(q: "What colour are roses ?", a: ["randomAnswer1", "Red", "randomAnswer2","randomAnswer3"], correctAnswer: "Red"),
The 2nd part I would need help with is:
If my quiz has 100 questions, how could I make the series of the questions to be RANDOM but UNIQUE every time the game is played?
Meaning that until the Quiz ends, each question would need to be displayed only once.
Thank you very much for your help!
1: There is a method to get a random element from an array
let random = answers.randomElement()
2: You can iterate and delete the used element, so next time you get a random element the array does not consist it
answers = answers.filter { $0 != random }

Query by item in array of document, and sort by item's position in the array

I have a collection dinosaurs with documents of this structure:
doc#1:
name: "Tyrannosaurus rex",
dominantColors: [
"beige",
"blue",
"green"
]
doc#2:
name: "Velociraptor",
dominantColors: [
"green",
"orange",
"white"
]
I want to query the collection by color name (for example: green) to get documents sorted by color's position in dominantColors array. First get the documents in which green occurs higher in the array, then those in which it is lower. So, in the provided case I would get doc#2 first, then doc#1.
Each dominantColors array contains 3 elements, with elements sorted from most dominant to least.
I am looking through documentation, but am not able to find a solution. Maybe I need a different data structure altogether?
Cloud Firestore doesn't support querying arrays by ranked index. The only way you can query an array is using an array-contains type query.
What you could do instead is organize your colors using maps where the color is the key and their rank is the value:
name: "Tyrannosaurus rex",
dominantColors: {
"beige": 1,
"blue": 2,
"green": 3
}
Then you can order the query by the value of the map's property. So, in JavaScript, it would be something like this:
firebase
.collection('dinosaurs')
.where('dominantColors.green', '>', 0)
.orderBy('dominantColors.green')

SSRS customized bar chart color

I've to show colors depending of the percentages of each bar in my chart report.
I'm using a expression in a "Series Properties"
=IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value <= 85, "Red",
IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value >= 97, "Green", "Orange"))
But all bar are showing in Red color
What I'm setting bad?
Thanks,
Eliana
I think your problem is that you are comparing to 85 and 97 when you probably ought to be comparing to .85 and .97. Also, you need to work with aggregate values, like this:
=iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) <= .85, "Red", iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) >= .97, "Green", "Orange"))
If that doesn't solve the problem, try creating a table using the same groupings you have for your chart and put this expression into a text box so that you can see what value is calculating:
sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value)
i think u can try Switch Clause for this,
syntax will be
=Switch(
(Fields!TotalComplete.Value / Fields!TotalJobs.Value) <= 85, "Red",
(Fields!TotalComplete.Value / Fields!TotalJobs.Value) >= 97, "Green",
"Orange"
)