0

About the issue of allowing edits only when conditions are met…”

I have created two tables for employees’ orders. I want to allow modifications to Customers.text only when Orders.Salesman is the same as Customers.Creator. How can I implement this? Thank you for your response.

10 replies

null
    • John_Halls
    • 5 mths ago
    • Reported - view

    If you have a professional subscription a whole lot of power comes with the upgrade. The Readable if... and Writeable if... sections are available at a table and a field level.

    Regards John

      • gold_cat
      • 5 mths ago
      • Reported - view

      Hello friend, I am a subscriber, but I would like to know how to write this code.

       

    • Fred
    • 5 mths ago
    • Reported - view

    FYI, when you want to do a report on all orders your current setup will make it difficult to script as you have to get data from different tables. What happens when you add a new sales person? Are you expecting to create a new table?

    Try to keep similar data in one table. What differentiates the two Orders tables, besides the sales person?

      • gold_cat
      • 5 mths ago
      • Reported - view

       Sorry, I didn't express some necessary information clearly.

       said:
      What happens when you add a new sales person?

      If the sales form belongs to Emma, then the salesperson will only be Emma and will not be changed to anyone else (I forgot to mention this). Because I only have two subscription accounts, I designed two salespeople's forms accordingly, so they will only see their own orders. (Or is there a better way to achieve this effect?) 

       said:
      Try to keep similar data in one table. What differentiates the two Orders tables, besides the sales person?

      I have streamlined the elements of the order form with the main purpose of ensuring that only the creator of a customer can modify the customer's information. There will be other elements, but overall, there won't be too much difference.

    • Fred
    • 5 mths ago
    • Reported - view
     said:
    (Or is there a better way to achieve this effect?) 

    Yes there is. Try not to mix security/permission with DB structure design.

    You can view this video

    to give you the basics on role based security.

    Nioxus also have training videos around security and permission. You may want to subscribe and watch them.

      • gold_cat
      • 5 mths ago
      • Reported - view

       

      I watched the video in detail, and it describes how to use accounts to differentiate viewing permissions and editing rights. However, my situation is a bit different.

      If I want to restrict each person to only view the information they edited in the table, the only solution I can think of so far is to create two identical tables. I haven't found a way to achieve this within a single table.

    • szormpas
    • 5 mths ago
    • Reported - view

     Hi, as  suggested and  mentioned, there is a simpler way.

    Open the Gear icon of the 'Customers' table then click on 'Edit fields...' and inside the 'Readable if' function put the following code:

    userName() = text('Created by')
    

    Could you try this and let us know if it works?

      • Fred
      • 5 mths ago
      • Reported - view

        once you get one user worker working, you may want to think about creating groups and using groups in your permissions. That way when your business grows you don't have to keep modifying the permission each time a user is added. Just add the user to the group and you everything else falls into place.

      • gold_cat
      • 5 mths ago
      • Reported - view

       I was overcomplicating the issue. Thank you for your help.

      • gold_cat
      • 5 mths ago
      • Reported - view

       I was overcomplicating the issue. Thank you for Fred help~

Content aside

  • Status Answered
  • 5 mths agoLast active
  • 10Replies
  • 58Views
  • 4 Following