Show name if issue - google-sheets

I'm organizing a spreadsheet for a game where I have the name, power, and class of all the member of my guild and I want to find the member with the highest power per class.
Example:
I want a formula that searches the highest value on the "power" column if the value on the "type" column is for example "Healer" and outputs the name of said member.
How can I do that?

try:
=INDEX(SORTN(SORT(A33:D; 3; 1; 4; 0); 9^9; 2; 3; 1);;1)

Related

How to Add Compound Indices in Shark Orm

I understand how to define one property indices in SharkORM per the documentation
+ (SRKIndexDefinition *)indexDefinitionForEntity {
SRKIndexDefinition* idx = [SRKIndexDefinition new];
[idx addIndexForProperty:#"name" propertyOrder:SRKIndexSortOrderAscending];
[idx addIndexForProperty:#"age" propertyOrder:SRKIndexSortOrderAscending];
return idx;
}
From my understanding the above will create one index on name, and another on age. However, what if I want to create a compound index (i.e. one that encompasses name first, and then age). If the above code is doing that, then my question is instead how do I define more than one index for a model?
To put it another way how would I define the following two indices in SharkORM?
[name, age]
[name, location]

Get Rapidminer to transpose/pivot a single attribute/column in a table

I have a table that looks like the following:
ID City Code
"1005AE" "Oakland" "Value1"
"1006BR" "St.Louis" "Value2"
"102AC" "Miami" "Value1"
"103AE" "Denver" "Value3"
And I want to transpose/pivot the Code examples/values into column attributes like this:
ID City Value1 Value2 Value3
"1005" "Oakland" 1 0 0
"1006" "St.Louis" 0 1 0
"1012" "Miami" 1 0 0
"1030" "Denver" 0 0 1
Note that the ID field is numeric values encoded as strings because Rapidminer had trouble importing bigint datatypes. So that is a separate issue I need to fix--but my focus here is the pivoting or transposing of the data.
I read through a few different Stackoverflow posts listed below. They suggested the Pivot or Transpose operations. I tried both of these, but for some reason I am getting either a huge table which creates City as a dummy variable as well, or just some subset of attribute columns.
How can I set the rows to be the attributes and columns the samples in rapidminer?
Rapidminer data transpose equivalent to melt in R
Any suggestions would be appreciated.
In pivoting, the group attribute parameter dictates how many rows there will be and the index attribute parameter dictates what the last part of the name of new attributes will be. The first part of the name of each new attribute is driven by any other regular attributes that are neither group nor index and the value within the cell is the value found in the original example set.
This means you have to create a new attribute with a constant value of 1; use Generate Attributes for this. Set the role of the ID attribute to be ID so that it is no longer a regular attribute; use Set Role for this. In the Pivot operator, set the group attribute to be City and the index attribute to be Code. The end result is close to what you want. The final steps are, firstly to set missing values to be 0; use Replace Missing Values for this and, secondly to rename the attributes to match what you want; use Rename for this.
You will have to join the result back to the original since the pivot operation loses the ID.
You can find a worked example here http://rapidminernotes.blogspot.co.uk/2011/05/worked-example-using-pivot-operator.html

In Factual how to get results with unique field values (similar to GROUP BY in SQL)?

I've just set out on the path to discovery of Factual API and I cannot see how to achieve a retrieval of a selection of entries each with a unique value in the specified field.
For example, give me 10 results from various cities:
q.limit(10);
q.field("locality").unique(); // no such filter exists
factual.fetch("places", q);
This would be an equivalent query in MySQL:
SELECT * FROM places GROUP BY locality LIMIT 10;
What I want is a little bit similar to facets:
FacetQuery fq = new FacetQuery("locality").maxValuesPerFacet(10);
fq.field("country").isEqual("gb");
FacetResponse resp = factual.fetch("places", fq);
but instead of the total for each result I would like to see a random object with all the information.
Is anything like this possible?

SSRS: Adding a filter that returns information from entire group

I am trying to create a report in SSRS. Below is a small example of what my dataset looks like.
Example Data Set
So, there are three different stores (A,B,C) and each has a landlord (a,b,c). Landlords can pay via three different methods (1,2,3) and the amounts paid per method are shown.
Right now, I have two filters set up. The first is by Store and the second is by Landlord.
What I am having trouble with is:
How can I set up a filter by the Amount that will return information from an entire Store/Landlord?
So for example, if I wanted to filter Amount by 150, I would like to return all the "payment" information for the store(s) that have a payment of 150. Such as the following:
Desired Result
Is it possible to add a filter to return information from the entire group? (Store and Landlord are the group in this case)
I am new to SSRS so any help/insight would be greatly appreciated!
You can use LookUpSet to locate the matching groups, JOIN to put the results in a string and the INSTR function to filter your results.
=IIF(ISNOTHING(Parameters!AMOUNT.Value) OR INSTR(
Join(LOOKUPSET(Fields!Amount.Value, Fields!Amount.Value, Fields!Store.Value, "DataSet1"), ", ") ,
Fields!Store.Value
) > 0, 1, 0)
This translates to:
If the Store value is found (INSTR > 0) in the list (JOIN) of Stores where the Amount is the current Amount (Lookupset).
In your filter, put the above expression in the Expression, change the type to INTEGER and the Value to 1.
[

Paradox SetRange does not provide correct result when querying 3 fields

I have a problem with setting a range on a secondary index in a Paradox 7 table using Delphi2010.
The relevant fields are:
FeatureType (int); YMax (int); XMax (int); YMin (int); Xmin (int).
The secondary index contains all these fields in this order.
I tested using a SetRange statement like so (not necessary to add all field values, rest is assumed NULL and all values are included):
table1.IndexName := 'YMaxIndex';
table1.SetRange([101, 280110400],[101, 285103294]); //386236 records
And tried to get a 0 result by adding to the constraints:
table1.IndexName := 'YMaxIndex';
table1.SetRange([101, 280110400, 1],[101, 285103294, 1]); //386236 records
But still gets 3863236, which is clearly incorrect when checking the values in the XMax field in the table.
Can someone please explain to me what I am not understanding about Paradox index and SetRange? I have used similar code frequently but not necessarily with 3 fields specifying the range.
Update
See Uwe's response below. The final code solution follows (new ranges for XMax):
Table1.SetRange([101,280110400], [101,285103294]);
Table1.Filter := 'XMax > 100000 and XMax < 110000';
Table1.Filtered := true;
An index range is always taken as a whole over all fields and not looking for each field individually. The result set will contain every record that is in between those ranges. The comparison is made for each index field in the given order.
In your case it will check if the record's FeatureType lies in between 101..101. If the field contains 101 it is taken into consideration. As the field value lies at the border of the range, the next fields are checked.
If the YMax field lies in between 280110400..285103294 and the value doesn't match the borders (280110400 or 285103294), it is taken into the result set without any further checking. In that case the remaining index fields are not checked.
The result you are trying to get is only possible with a filter condition - or with an appropriate SQL Select clause.
for range set with
table1.SetRange([101, 280110400, 1],[101, 285103294, 1]);
Folow values are in range
101 280110400 1
101 280110400 2
101 280110400 3
....
101 280110401 -maxint
....
101 280110401 maxint
....
101 285103294 0
101 285103294 1
A little clarification to the previous answers:
SetRange checks separately the range start and end conditions, for example we have
SetRange([1,2], [2,2])
and record (1, 3);
Range start: we have 1 = 1 for the first field (boundary), so we check the second field (2 < 3) - the range start condition is satisfied.
Range end: we have 1 < 2 for the first field (not boundary), so the second field is not checked - the range end condition is satisfied.
The record is in range.

Resources