Clear Table Results

[code]headers = [“Value”,“Label”]
data = []

clear_data = system.dataset.toDataSet(headers,data)
event.source.parent.getComponent(‘Dropdown’).data = clear_data
[/code]

I have this code that clears the data on the my second drop down list ,
what about when I want to delete the records on the table when the label “” is chosen on the drop down list, kind of just clears the record…

I think this is what you want to do.

Add this code to the property change on the drop down menu:

if event.source.selectedLabel == '<Select>':
	headers = ["Value","Label"]
	data = []
	clear_data = system.dataset.toDataSet(headers,data)
	event.source.parent.getComponent('Table').data = clear_data

Chris

it did clear the whole table. but i just wanted to clear the results that was on column 3

Like this:

if event.source.selectedLabel == '<Select>':
	#Set column number. Starts at 0 from left.
	col = 2
	temp_data = event.source.parent.getComponent('Table').data
	for row in range(temp_data.rowCount):
		temp_data = system.dataset.setValue(temp_data, row, col, '')
	
	event.source.parent.getComponent('Table').data = temp_data

Chris

Cool it worked! Thank You! :thumb_left: