|
|
Re: Use a table with only rdcaccount_id as primary key [message #1796 is a reply to message #1795] |
Thu, 06 November 2008 13:27 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The documentation at http://www.tonymarston.net/php-mysql/virtual-private-databas e.html#implementation clearly indicates that you must use rdcaccout_id IN ADDITION to an existing key, so it is not possible to use it on its own.
It is possible to go to an UPDATE1 screen without starting at a LIST1 or LIST2 screen, but only if the current screen has the identity of the correct record in its WHERE string. Alternatively you can put code in the _cm_initialise() method to supply the relevant value manually, which means that the contents of the WHERE string as provided by the parent form becomes irrelevant.
If you are saying that the contents of the LIST1 screen should only show a single record, then you need to modify the ADD1 screen so that it will not allow additional records to be created. This can be done by hard-coding a single value for the primary key, thus avoiding the possibility of any user providing a different value.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: Use a table with only rdcaccount_id as primary key [message #1800 is a reply to message #1794] |
Fri, 07 November 2008 11:31 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Thanks Tony, your reply has given me an idea for a solution that will work in the way I want. I had already taken care of the user not being able to add a second record through validation when the 'New' button was pressed, preventing further processing and giving an error message.
I think the solution I will use is to add a second field as primary key along with rdcaccount_id to comply with the requirements of this functionality. But I will populate it from rdcaccount_id within the code (i.e. an equal value). This means each account can have only one record (they don't need to see the value of the primary key) and I know what the value is (from rdcaccount_id) to be able to retrieve it.
|
|
|