Announcement

Collapse
No announcement yet.

How to suppress new records?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to suppress new records?

    I have the situation that I can have only max one record of a kind. So the situation is that at first there's no record and you need to click add. Then after insert I want to disable add buttons and goback to the just added record.

    Problem is that if I don't do anything and you add a record the add button persists and will generate a duplicate key on the next hit.

    I would like to be able to redir to the same application so it will show the just inserted record in save mode. But if I do that then the record is not stored.

    How can I achieve this?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    To Supress new record based on n records in your db,
    I THINK THE MOST RELIABLE WAY TO ACHIEVE THIS IS WITH MAKE STORED PROCEDURE IN YOUR DB.
    EX :
    //create procedure that have query like "select count(column) from table"
    //on your events form --> before insert "sc_lookup(data, "call procedure above");
    if ({data}>=1)
    {
    sc_error_message("you can not add new record!!.");
    }

    Comment


    • #3
      Since this would still generate an errormessage similar to duplicate key it's not what I'm looking for. I managed to create a little procedure in the onload to test if there's a record. If not I add it. In the toolbar I removed insert and delete and... voila. Tnx, for your reply.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment

      Working...
      X