Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

restrict max number of records for a customer

Discussion in 'Information Technology' started by john, Nov 17, 2005.

  1. john

    john
    Expand Collapse
    Guest

    how do i create a table for a online shopping so that each customer can only
    buy a max of 5 objects. I like to do it so that the max amount can be
    changed easily in the future.

    thankx in adv
     
  2. Loading...


  3. Smartin

    Smartin
    Expand Collapse
    Guest

    john wrote:
    > how do i create a table for a online shopping so that each customer can only
    > buy a max of 5 objects. I like to do it so that the max amount can be
    > changed easily in the future.
    >
    > thankx in adv
    >


    One way: set up a table (MaxObjects) with one field (MaxObject) and one
    record, which you set to 5. Include logic in your AddObjectsToOrders
    routine that looks at this value before a new order object is created.

    --
    Smartin
     
  4. john

    john
    Expand Collapse
    Guest

    Is there no other of way of doing this? id prefer it if there was a
    validation rule or coding to correct this problem

    "Smartin" wrote:

    > john wrote:
    > > how do i create a table for a online shopping so that each customer can only
    > > buy a max of 5 objects. I like to do it so that the max amount can be
    > > changed easily in the future.
    > >
    > > thankx in adv
    > >

    >
    > One way: set up a table (MaxObjects) with one field (MaxObject) and one
    > record, which you set to 5. Include logic in your AddObjectsToOrders
    > routine that looks at this value before a new order object is created.
    >
    > --
    > Smartin
    >
     
  5. Smartin

    Smartin
    Expand Collapse
    Guest

    john wrote:
    > Is there no other of way of doing this? id prefer it if there was a
    > validation rule or coding to correct this problem
    >
    > "Smartin" wrote:
    >
    >
    >>john wrote:
    >>
    >>>how do i create a table for a online shopping so that each customer can only
    >>>buy a max of 5 objects. I like to do it so that the max amount can be
    >>>changed easily in the future.
    >>>
    >>>thankx in adv
    >>>

    >>
    >>One way: set up a table (MaxObjects) with one field (MaxObject) and one
    >>record, which you set to 5. Include logic in your AddObjectsToOrders
    >>routine that looks at this value before a new order object is created.
    >>
    >>--
    >>Smartin
    >>


    Sure, a "hard coded" validation rule in code could do the same thing.

    You mentioned "changed easily in the future", which is why I suggested
    building a simple table. The validation rule can use the table data. If
    the business rule changes later you can easily update the table (e.g.,
    through an administrative form).

    Putting the limit in the code may be more difficult to maintain
    depending on your circumstances.

    Hope this helps!
    --
    Smartin
     

Share This Page