plomino/Plomino — Issue #48: subForm and Datagrids
Author: betorom
Created: 2012-01-31 21:37:34+00:00
State: open

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.