Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page