Add_row to app_tables Wrong number of arguments

Hi…

I am trying to fullfill a row in the iniciojob app_table with add_row

app_tables.iniciojob.add_row(1, 1,2,3,4,5,6,7,8,9)

iniciojob table:

and I have this error:

TypeError: Wrong number of arguments (10) passed to add_row(). Did you pass keyword arguments as positional arguments, or vice versa?

What am I doing wrong?

In reality, I want to add the data below but I can’t even insert a simple row like the one I mentionned…

result_list =
[[[41], [67.70000000000005], [89], [317.5], [357], [446.5], [500.5], [550.5], [607]],
[[0], [33], [57], [81], [143], [193], [307], [307], [307]],
[[73], [93], [109], [188.5], [217.5], [307], [323], [345], [607]],
[[53], [65], [95], [146], [235.5], [307], [361], [576], [607]],
[[101], [134], [158], [220.5], [282.5], [332.5], [446.5], [446.5], [457]],
[[142], [166], [190], [285.5], [339], [446.5], [462.5], [484.5], [607]]]

One line to one iniciojob table row…

whith something like this:
for m in range(0, 9)
row = app_tables.iniciojob.add_row(m,result_list[m])

And there is a sintax error and maybe other errors (working with arrays, lists, dictionaries, tuples… is a little confusing).

Thank you for your help.

add_row doesn’t accept positional arguments.

You need to provide one named arguments per column. Something like this:

app_tables.iniciojob.add_row(producto=1, M1=1, M2=2[, ...])
2 Likes

and you can also use ** to unpack a dictionary, like:
mydict={‘field1’:2,‘field5’:6}
app_tables.my_table.addrow(**mydict)

Are you sure you need separate columns for this?

You could use the “SimpleObject” column to store a list of values in your datatable.

Is this a good idea? If you need to search by a column (i.e. my_table.search(M1=1)) probably not.

Otherwise though, this might make your life a LOT easier… For example you’d be able to store each array in your list of arrays exactly as-is using a SimpleObject column.

2 Likes