Multiselect widget in Databricks notebook - apache-spark-sql

I made multiselect widgets in the databricks notebook.
dbutils.widgets.multiselect("Scenario", "Actual", [str(x) for x in scenario_type])
But I wanted to use the selected value to update the table I have.
Once there is only one item selected, it works.
display(ur.filter((ur.scenario == getArgument("Scenario")))
However, if I select multiple items, it didn't obviously.
Do you know how to make multi-selection work in my scenario?
Thanks.

You can make the list from selected values and use isin method to filter the records.
myList = getArgument("Scenario").split(",")
display(ur.filter(ur.scenario.isin(myList)))

Related

Adding multiple SelectElement into IList for iteration

I am trying to iterate into multiple drop-down boxes and select value in each one of them, now the drop-down boxes are variable, is there a way to do that, I tried this:
IList<SelectElement> allDropDowns = mydrive.FindElements(By.CssSelector
(".custom-select.fileType.form-control"));
After working on it, I got the solution (or atleast it works !)
IList<IWebElement> allDropDowns = mydrive.FindElements
(By.CssSelector(".custom-select.fileType.form-control"));
Then assign each list item to SelectEelement
SelectElement selectFileType = new SelectElement(allDropDowns[index]);

Cannot select item from Drop down selenium WITHOUT select

I am new to Python and trying to figure out how to call an item from the drop down list. I managed to make it visible with this code.
price_point = driver.find_elements_by_class_name("chosen-single")
price_point[0].click()
I cannot use Select.
The list is open and visible now But I am not able to click the items inside the list. Any ideas?
Your help is much appreciate!
Access the list item directly and click on it. Here is the sample
driver.find_element_by_xpath("//select[#class='chosen-single']//option[normalize-space(.)='here goes your list item text']").click()
if you have more than one list boxes with class "chosen-single" then use the below to select the item from first list box.
driver.find_element_by_xpath("(//select[#class='chosen-single'])[1]//option[normalize-space(.)='here goes your list item text']").click()

Is there an Python-PyQt5 function for multiselecting from a list using QCombobox?

I am trying to build a GUI with a dropdown for multi-select in python, PyQT5 but, the display is only showing single item instead of a dropdown. Is there a way to include the options as a drop down ?
QlistWidget has the setSelectionMode: QListWidget and Multiple Selection
But the combobox does not seem to have it. And I don't remember seeing a combobox with multi selection on.
No, you can't select multiple item from a QComboBox instance. It can be used to select only one item at once. If you want to have multiple selection in your widget have to use a QListView/Widget.

Powerbuilder multiple select in dropdown

Is there a multiple select option for the datawindow dropdown in powerbuilder? I have a dropdown (dddw) and I need to select more than one value. How can I do that?
Thanks!
Nope. A dropdowndatawindow is a single select object. You can do this via a listbox. Here is a link which may help you from the old PowerBuilder Developers Journal. You basically set the muli select property of the listbox to true. Populate the entries. Then loop through the selected items.
There also is a discussion string on this topic in the SAP archives (SAP used to own PowerBuilder). There is a custom control by Balu Ramasamy which may help too.
I don’t know how to make Powerbuilder select multiple rows in a dropdowndatawindow, but I had a situation where it did select multiple rows and I didn’t want it to. I had to turn off the prior row and reselect the new row. I added this code to the itemchanged event when transaction_reason changed.
DataWindowChild ldwc_Reason
this.GetChild('transaction_reason', ldwc_Reason)
// unselect prior reason's'
ldwc_Reason.selectrow( 0, false)
// select the current reason
ldwc_Reason.selectrow( ldwc_Reason.getrow(), true)

VB Getting the selected item from a List View

I have a list view with two columns and I'd like to be able to save the value of the leftmost column for the selected row, or even better make it so that once the user clicks on either the right or left column of any given row, the entire row selects and not only the field that was clicked.
However I'm struggling to get the field saved which is more crucial than the row highlighting.
In a list box it would be
string = listbox1.selecteditem.tostring
However this doesn't seem to work for the list view. It won't even let me put "Selecteditem" and instead requires I put selecteditems, however this doesn't seem to do what I want either.
When I use the code:
string = ListView1.SelectedItems.ToString
I get the result of
string = "System.Windows.Forms.ListView+SelectedListViewItemCollection"
Despite the selected field actually being "EGG".
I need to have two columns so can't switch to using a listbox, although that seems like it would be the easier solution.
When I tried googling this question I could only find things for C#
Set FullRowSelect on to get the entire row to select.
SelectedItems.ToString refers to the collection of selected items.
SelectedItems(0).Text refers to the first selected item's text property.