Get styleData.depth from other column than 0 - treeview

I have a QtQuick1 TreeView and would like to access the depth of the current row in a delegate.
styleData.depth provides exactly what I need. However, only for column 0. I need this piece of information for columns >0. There, styleData.depth is reliably 0 on every level.
What is the most elegant way to access the depth in the other columns? Putting the depth into my model is a very unelegant possibility that I would like to circumvent.

Related

How can I filter results by parent values, after grouping?

Although I think this should be straightforward, I cannot seem to find the answer to this in relevant ag-grid documentation.
When I group an ag-grid, the parent nodes show the grouped values. For example, I might see a sum. This part is good.
But when I filter on this grouped grid, the filter only considers values at the leaf node level. I want to be able to filter on the aggregate parent values. How do I do this?
To be more specific, ag-grid provides a filtering example: https://www.ag-grid.com/javascript-data-grid/grouping-filtering/
The filter values are: 0, 1, 2, 3 (the leaf node medal counts). But I want to filter by countries with sum(Gold) > 10, so I want to filter on the sums (34, 11, 35...). I am surprised the sum values don't factor anywhere into the filter dropdown and was hoping to get some direction on this.
I received some details from ag-Grid, and thought I'd share them here to help someone else looking for same. Basically, this functionality does not yet exist.
It's a known limitation, and already part of the tracking pipeline under ticket AG-1228 (but unfortunately does not look to be slated for implementation soon):
Screenshot was taken from: https://www.ag-grid.com/pipeline/

How to correctly structure a DynamoDB table for sorting results with no hash key condition?

I am new to DynamoDB so I'm still trying to understand how to use it, but I have what I believe is a simple task but I'm not sure how to address it.
I need to create a table to store categorized questions in which I need to store a click counter. So let's say something like this:
ID: 1
Question: What is this?
Category: General
Clicks: 100
Now, the problem is I need an optimized way to get the most general clicked questions and the most clicked questions by category, let's say a top 10.
In a classic SQL style it would be something like this:
SELECT ID, Question
FROM Questions
ORDER BY Clicks DESC
LIMIT 10
Can anyone point me in the right direction on how to structure the table? I tried the sorting but it always requires a hash key condition, so I don't understand how I can get this done as I need the top 10 results and not a single one.
Thanks in advance!
How are you accumulating the clicks, if you are able to figure out how you accumulate the clicksstream onto the table correctly that will be your answer.
You will need to implement a mechanism that maps incoming clicks to the item record being clicked on and increment it using an atomic counter. With this you will be able to then create a sparse index and sort it in descending order to get what you need.

ArrayFormula column disappears when sorting in a filter view in Google Sheets

I'd like to use ArrayFormula to populate a column in spreadsheet, but when I Sort A->Z in a filter view, the ArrayFormula column vanishes. In some cases, the column includes a #REF! error about the range, and in some cases the column is just blank after the Sort. The following is a simplified version of what I'm trying to do (in my actual application, I'm doing a Vlookup to another sheet):
https://docs.google.com/spreadsheets/d/1XbqqedOjuSKuE-ZLIHNw59-r01EsNMpx7YVqOoxSOR4/edit?usp=sharing
The column 3 header uses an ArrayFormula to copy from column 1. If you go to the Filter 1 filter view, you'll note that column 3 is blank except for an error. This happens after I try to Sort Z->A on column 2. In my more complicated use-case, involving a Vlookup, after a Sort the column disappears entirely (leaving no #REF! error). Before sorting in both cases, everything is fine.
How do I make ArrayFormula values persist in filter views after sorting?
Thanks for your help!
I'm guessing that, because your references are normal (relative, not anchored/absolute), the range A2:A10 after sorting down turns into something absurd, like A7:A4, depending on actual sorted values.
Also, if you hover with your mouse on the #REF error, what does it tell you?
Anyway, try using absolute references in your formula:
=arrayformula({"Column 3"; A$2:A$10})
Edit
Fascinating. It's the first time I see this type of error. Taking it at face value, it seems that it's a limitation of Google Spreadsheets - you cannot use ARRAYFORMULAS spanning multiple rows inside sorted filter views, because, like I sort of guessed, it messes up the ARRAYFORMULA's range (as indicated by the fact that the formula is now in C4 instead of C1).
But that gives you also the solution: do not include the cell with the arrayformula in the filter view. Instead of making your filter view's target range A1:C20, make it A1:B20. Then the arrayformula in C1 will be untouched by the filter and will indeed continue to work.
I have found a solution for my usecase, in your case, it could be:
=arrayformula(if(row(C:C)=1;"Column 3";A:A))
But you'll need to consider the whole columns in your formulas.
Example
Have you tried A2:A?
If you don't put an ending row, means the end of the column.
It worked for me.
Cheers

Not able to get the cell data of Java tree - UFT

When I am using getcelldata method for Java tree object, nothing is being returned.
Celldata=javawindow("Oracle").javatable("Console").getcelldata(1,1)
Celldata=javawindow("Oracle").javatable("Console").getcelldata("#1","#1")
Please help.
There could be few possible reasons for this
1) You are not using the correct row and column numbers for fetching the data. Row and column starts with 0. So if you want to fetch the data for row 1 and column 1 then your statement should be
GetCellData 0,0 not 1,1
To check if you are on the right row and column you can use ActivateCell or ClickCell functions. Both of these function indexes starts with 0, so they should match.
2) Check if there are any child controls inside the table cell, sometimes that will cause issues getting the data from the cell, because if cell is having a custom control inside it then cell technically does not have the data.
To check this use the childObjects function
3) If GetCellData is not working, then you can also check, if you are able to add the table cell directly in the object repository and get the text using GetROProperty.
4) If nothing else works then you can also check the native functions and properties.
To access the native properties and function you can use object spy.

Get conditional mode efficiently in Excel

I am looking to find the mode (most occurrent) value of one column, given another column.
I know how to do it but the calculation takes multiple minutes and can make Excel unresponsive. Therefore I am looking for a better way.
Suppose my data looks like this
group | Level
1 D
1 A
1.1 B
1 C
1 A
1 E
Then I want the output to look like this:
group | LevelMode
1 A
1.1 B
Assuming the data is in the upper left corner of the worksheet, I am now using this formula, which I drag along the C column:
=COUNTIFS(A:A;A2;B:B;B2)/COUNTIF(A:A;A2)
This gives me the ratio of values within the group. Afterwards I remove all that are not above 0.5 as well as duplicates, giving me the mode for each group if it exists.
This formula does exactly what I want, but for about 50000 lines it simply takes too many resources. I expected to find this in the pivot table options, or after a quick search online, but I have not found any way to achieve my goal.
I have decent hardware, a fairly recent version of Excel and would prefer to do this without macro's. However, if macros are required to achieve this then so be it.
Try this:
Step 1.
Create the Pivot Table and place in RowLabels "Group" and under it "Level". Now, place "Level" as count in "Values" field.
Step 2.
See the picture below. Click in the black arrow in the right side of "Level" (you can't see it in the picture but it is supposed to be inside the red circle).
Choose "Values Filters", then "Top 10" and then set the number to 1 (top 1). Done!!
Attention: you need to do step 2 for "Level". If you do the same to "Group" it will not work.
Edit: this is the result and how the Pivot Table should look like.
Now to shape the output to the desired format:
Under PivotTable tools > Design, set the Report Layout to Tabular form
Disable totals and subtotals
Assuming default settings you can now easily copy the list of Groups and LevelModes

Resources