I have a QTableView and I need to the get value (string) from the first cell of the selected row (any cell on the row could be selected). But I need this value only if exactly one row was selected.
I thought - I need to get index of the selected row and then get the value of the first сell on that line, but I couldn't find a way to do it.
myTableView->selectionModel()->currentIndex().row()
Will give you the index of the currently selected row. From there you should have enough information to look up the row/column pair in your model.
Also, QItemSelectionModel::selectedRows() will let you know how many rows are selected.
Python Code will look like :
self.tableView.clicked.connect(self.on_Click)
When User Click on Table Cell the on_Click() method is invoked
def on_Click(self):
# #selected cell value.
index=(self.tableView.selectionModel().currentIndex())
# print(index)
value=index.sibling(index.row(),index.column()).data()
print(value)
Explanation.
"value" contains the cell value of the selected cell.
index.row() # gives current selected row.
index.column() # gives current selected column.
index.sibling(index.row(),index.column()).data() # will return cell data
Related
I have two lists of people - they will not be sorted in the same order. The second list is in a different sheet. If the person listed in column A shows up in Column A in the second sheet, I want column F to display "Y." If not, I want column F to display "N."
This formula: =ArrayFormula(vlookup(A2:A,Attendees!A2:A,1,0)) almost gets me there, but I can't figure out how to get it to return Y/N instead of the name of the Attendee or not.
Any ideas?
try:
=ARRAYFORMULA(IF(IFNA(VLOOKUP(A2:A, Attendees!A2:A, 1, 0))="", "No", "Yes"))
Input
Customera, c-customerrb, b-customerc
Ouput
c-customerrb
Here Customera, c-customerrb, b-customerc is a value of a cell.
I need to find out in each cell of column "C-". If the value found. it shuould return value as "C-customerrb"
Create a Calculated column
Column = IF(CONTAINSSTRINGEXACT(Search column,"search string"),search column,"")
Having imported an excel sheet into power query, I need to tidy it up by changing the value of a particular cell.
At the moment that cell has a null value, but there are other null values in the same column that I do not want to change. – So I cannot replace all of the null values in that column with another value.
I also cannot correct that particular cell in the source excel file (there are hundreds of them, which were created before I arrived).
I basically need some syntax for example that sets the value of cell H2 to “Jeep”, but not to change any other cells.
Very grateful for any insight.
One way would be:
In the Power Query Editor:
Add an index column starting from 1 (tab Add Column)
Add a Conditional column: If [Index] = 2 then Jeep else [H] (tab Add Column)
Delete Index column and [H] Column
Rename Custom column to [H].
i have two sheets. first column of both sheets has userids, but there is only some overlap of ids between the two sheets. i want to keep the userids in the first sheet, but in the second sheet, the second column has a point of data that i want. for those userids in the first sheet that are also in the second sheet, i want to get this data.
so, for say the first row's userid in the first sheet, how could i use vlookup to find that same userid in the second sheet (if it exists), get the value of the second column of that match, and bring it back to the second column of the first sheet?
thanks
Modify and put this formula into the first cell of the second column on the first worksheet. Then copy and paste it down the column:
=VLOOKUP(A1, Sheet2!A$1:B$100, 2, FALSE)
Let's look at the parameters for this function:
A1: This value, on this worksheet, is what we're searching for in the range given in the next parameter. When you copy and paste the entire formula down the column, it increments the row # with each row. In row 2, it will be modified to A2, and so on.
Sheet2!A$1:B$100 : This is the range that we are interested in, on the second worksheet. It is the top left to bottom right cell. The $ symbol tells Excel not to change the row #'s when you copy and paste the formula down the column. Modify B$100 to fit the range of data you are interested in... something like B$30 if you only have 30 rows of id's on the 2nd sheet.
2: This is the column you are interested in retrieving the value, relative to the above parameter. In this case, the 2 corresponds with column B.
False: This instructs Excel to find the exact match.
I have a Ultradropdown in which I have to set the row in select as default. I have a value of the row through which can I make the row selected?
//Code
Dim workflowId = 256
cboWorkflows.ActiveRow = ???
In the above code the dropdown has a column in which one of them contains the value 256. so using that I should now make the row selected in dropdown.
How to achieve this?
If you are aware of the column name you could do it like the following:
For Each row As UltraGridRow In UltraDropDown1.Rows()
If row.Cells("YouDesiredColumnNameHere").Value = 256 Then
row.Activate()
End If
Next
If this is not helpful, please provide me more details about the usage of the UltraDropDown in your application.