Closed betorom closed 12 years ago
I guess line 10 is: valueslist = [row[0] for row in datagrid_rows] the error means the datagrid contains an empty row (so row[0] does not exist)
to prevent that: valueslist = [row[0] for row in datagrid_rows if row]
Eric
Hi, I have a 'form1' with a selection-list field named 'selectionList'. I have a 'form2' with a datagrid field named 'the_datagrid'. Now in a 'form3' I am using 'form1' in a datagrid field, I also have a parameter in the url that I want to use to fill the selection-list of 'form1', for that I am trying to get the parameter so I have this formula in the selection-list field of 'form1':
db = plominoDocument.getParentDatabase() view = db.getView("allForm2") name = context.REQUEST.get("name") doc = view.getDocumentsByKey(name)[0] datagrid_rows = doc.getItem('the_datagrid', []) valueslist = [row[0] for row in datagrid_rows] return valueslist
But I have this error: File "Script (Python)", line 10, in field_frm1_selectionList_SelectionListFormula IndexError: list index out of range Context is /.../myfolder/mydatabase/frm1
Thanks.