So you want to bind the data in one row to a table such that the table will have basically one cell of data and no more? Is that what youâre asking? Or are you trying to get the data in one specific cell of a larger multi-cell table to display one of these binary values? Please clarify.
I apologize for the confusion and will attempt to clarify. I would like to have each binary row bound to its own respective table. In that, I would end up with 12 tables each with only one row of data (a column for each bit). The dataset for each table would be 1R x 33C.
So youâll need another math function to get the bits from your integers and append each bit to the list. I have a function that does this, but wonât be back in the office to copy/paste it until next week.
It might make more sense to create just one dataset with many rows, write that dataset to a custom dataset property on the screen, and then use cell update bindings on your other tables.
I tweaked what you posted a bit. Toward the top is a loop that generates the headers. Toward the bottom, I made a hypothetical change (because I have no idea what your table names are⌠;)) to generate table names and split each conversion to the binary value (minus the âbâ, and ignoring the bitcount).
if event.clickCount == 2:
# generate header names (bit31, bit30, ..., bit0)
headers = []
for i in range(31,-1,-1):
headers.append('bit'+str(i))
if event.source.selectedRow != -1 or 0:
data = event.source.data
row = event.source.selectedRow
value = data.getValueAt(row, "intValue")
selId = data.getValueAt(row, "index")
stepNumber = data.getValueAt(row, "stepNumber")
for i in range(data.rowCount):
id = data.getValueAt(i, "stepNumber")
value1 = data.getValueAt(i, "intValue")
newList = []
if selId == id:
newList.append(value1)
binValueList = []
for j in range(len(newList)):
# genrate tableName
tableName = 'table' + str(j+1)
# convert to binary (remove 'b' and ignoree bitcount)
binValue = list(shared.math.dec2bin(value1)[0][:-1])
event.source.parent.getComponent(tableName).data = system.dataset.toDataSet(headers, [binvalue])