1

Avoid new records

How can I avoid adding records in the main table?

8 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    If you only want one record in a table (for example if you use a "Settings" table) , you can use

    'delete this' (without the quotes) in the "trigger on new record" field of your table.

      • pascalp
      • 2 mths ago
      • Reported - view

      Hello,

      Is it possible to have a message with a choice if one wants to create a new record or not?

      Thanks.

      • pascalp
      • 2 mths ago
      • Reported - view

       I try this:

      if count(ID) > 1 then alert(“message”), but it does not work. Nor if sum(Id) > 1.

      • Fred
      • 2 mths ago
      • Reported - view

      Is this in a button? Is this in a dashboard? Or in a data table? Are you checking another table or the current table?

      • pascalp
      • 2 mths ago
      • Reported - view

       «Trigger on new record» of the current table.

      • Fred
      • 2 mths ago
      • Reported - view

      It seems like it is a bit late to pop up a message after the new record is created, but let me answer your question.

      Be aware that once you move your DB into the cloud for multi-user access then you need to know when and where actions execute. This page from Ninox shows you when and where actions execute. For your case, with the iPad app and a "local" DB, the Trigger on new record happens in your app. But if you move the DB to the public cloud then the actions happen on Ninox's server so you won't see any alerts() or dialogue().

      Your script:

      if count(ID) > 1 then alert(“message”) end
      

      Doesn't work because

      1. I'm not sure what ID is?
      2. you are not counting the entire table only the current record

      You can try:

      let allRecs := select tablename;
      if length(allRecs) > 1 then alert("message") end
      

      But then you will always see this message when you create a new record. And it is after the new record has been created so it is too late.

      You should look into dashboards/pages. If you want to control user actions you need to create a UI that allows you to take control.

    • clonev
    • 2 yrs ago
    • Reported - view

    Hi RoSoft_Steven, thanks for your reply.

    In another hand, It's possible to disable the + symbol at the end of the first column and the one at the bottom of the table?

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    This can only be done by using the user role permission in the 'Create new records' setting of your table.

    Which is only available in cloud subscription.

Content aside

  • 1 Likes
  • 2 mths agoLast active
  • 8Replies
  • 178Views
  • 4 Following