Add new related record for table with calculated fields
Posted: Thu Jan 28, 2010 4:55 am
Hi,
I have a table (lets call it table1). In fields.ini for that table I have a rather complicated query (with a couple of subqueries) for a number of calculated fields (http://xataface.com/documentation/how-t ... tails-view).
I have another table (called table2) which is in a relatiosnhip with table1. In relationships.ini for table2 I have:
The problem is that when I want to add a new related table1 record from table2 view I get the following warning (and no input fields are shown - just the "save" button):
I tried 2 things.
1. Change relatiosnhip.ini for table2 into:
But the parser failed to interpret that.
2. Created a view for my complicated query and changed relatiosnhip.ini for table2 into
But this way I get an error saying that the view has no primary key.
How can I get around this problem?
Thanks.
Paul.
I have a table (lets call it table1). In fields.ini for that table I have a rather complicated query (with a couple of subqueries) for a number of calculated fields (http://xataface.com/documentation/how-t ... tails-view).
I have another table (called table2) which is in a relatiosnhip with table1. In relationships.ini for table2 I have:
- Code: Select all
[table1]
__sql__ = "select * from table1 where table1.id='$id'"
The problem is that when I want to add a new related table1 record from table2 view I get the following warning (and no input fields are shown - just the "save" button):
- Code: Select all
Warning: reset() [function.reset]: Passed variable is not an array or object in /opt/lampp/htdocs/ule/xataface/Dataface/ShortRelatedRecordForm.php on line 274
I tried 2 things.
1. Change relatiosnhip.ini for table2 into:
- Code: Select all
[table1]
__sql__ = "<<the same complicated query from fields.ini for table1... where table1.id='$id'>>'"
But the parser failed to interpret that.
2. Created a view for my complicated query and changed relatiosnhip.ini for table2 into
- Code: Select all
[table1]
__sql__ = "select * from my_view where my_view.id='$id'"
But this way I get an error saying that the view has no primary key.
How can I get around this problem?
Thanks.
Paul.