Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Use a table with only rdcaccount_id as primary key
Use a table with only rdcaccount_id as primary key [message #1794] Thu, 06 November 2008 11:02 Go to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Tony,

I think I inadvertently made use of a bug that you fixed in version 1.40 Smile

I am making use of the virtual private database features of the framework. As such I have a table that effectively contains a 'parent' record for users, and by definition a user can only have ONE such record. I am having to implement that within the application as I can't control that through the data model. The primary key of this table is rdcaccount_id only.

I had implemented a LIST1 transaction (as for all other tables in my app) although this didn't really fit the contraint of having only one row allowed (couldn't figure out how to go directly to an UPDATE1 screen). Since your code fix I now cannot select the record and get 'Nothing has been selected' message when trying to select the record for updating. (I think you process the rdcaccount_id in a specific manner somewhere).

Ideally, I'd like to go straight to an UPDATE1 screen with the record selected by rdcaccount_id automatically displayed. Can you suggest how this might be achievable (hope I've explained this well enough.

Thanks.
Re: Use a table with only rdcaccount_id as primary key [message #1795 is a reply to message #1794] Thu, 06 November 2008 11:08 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Additional note to clarify previous question:
I know I can overcome this problem by adding another field into the primary key of the table, thus making the LIST1 transaction work again, and allow me to select the record for update.

But I'd like to improve this by not having to select the single (by definition) row retrieved by the LIST1 before displaying the UPDATE screen and instead display an UPDATE1 transaction directly.
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 Go to previous messageGo to next message
AJM is currently offline  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.


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 Go to previous message
gpatti is currently offline  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.
Previous Topic: How do you activate the new Google Style Pagination
Next Topic: Where does <imagename> search for the image in pdf multi?
Goto Forum:
  


Current Time: Sat Nov 30 02:43:23 EST 2024

Total time taken to generate the page: 0.00902 seconds