0

Making a field writable based on a condition

Hello Friends,

I am not able to wrap my head around this thing. I want to make the "To Address" text field writable if the selection in the choice field is "OTHER". Apart from "OTHER" if it is anything else, the "To Address" text field should not be writable.

 

So I have written this condition in the Writable If setting of the "To Address" field:

upper(text('To Wallet')) = upper("other")

I don't know what am I doing wrong, but this thing is not working. The only thing that works is if I hardcode "true" or "false" in the setting.

upper(text('To Wallet')) = true

The reason I want to keep the field as non writable for rest of the options is 'cuz if I choose any other option apart from "OTHER", it autofills the wallet address.

 

Please help !!

13 replies

null
    • John_Halls
    • 3 wk ago
    • Reported - view

    I have recreated a working version of this with no issues

    upper(text('To Wallet')) = upper("other")

    Not sure what is wrong. What values of 'To Wallet' do you have?

    What I would say is that it's always better to use the number associated with the choice. In my version, it is the third choice and I would put

    'To Wallet' = 3

    Regards John

      • Fred
      • 3 wk ago
      • Reported - view

      I can confirm that I am able to make toAddress writable/not writable in both public cloud and Mac app with local DB with:

      text(toWallet) = "Other"

      toWallet is a simple choice field, but it should be no different with a dynamic field.

    • Rafael Sanchis
    • Rafael_Sanchis
    • 3 wk ago
    • Reported - view

    It is also confirmed on Android as well

    • Ninox Developer
    • vermau81
    • 3 wk ago
    • Reported - view

    I don't know what's wrong with my app then. I tried this at least for 1 hr with different options before posting in the forum.

    I will try once again !!

    Thank you all for your help

      • Fred
      • 3 wk ago
      • Reported - view

      can you upload a sample db that isn’t working?

    • Ninox Developer
    • vermau81
    • 3 wk ago
    • Reported - view

    Here is the sample database..

    I still can't enter anything in the text field. It is locked for editing unless I just write "true" in the Writable only if setting.

    I don't know what is wrong. I have tried everything... Restart the computer, take backup, delete database and open from the backup.. Nothing has worked.

    • John_Halls
    • 3 wk ago
    • Reported - view

    Thanks for the demo. Using the number associated with OTHER works, so try

    number('To Wallet') = 23
    

    Regards John

      • Ninox Developer
      • vermau81
      • 3 wk ago
      • Reported - view

       No, it did not work. I want to avoid using the number is 'cuz I might add new items in the dynamic choice field in the future.

      • Fred
      • 3 wk ago
      • Reported - view

      That is so weird. Looks like the Writable if is kind of wonky. If you create a formula field with something similar:

      if text('To Wallet') = "OTHER" then
          "YES"
      else
          "NO"
      end
      

      it works fine. But you put in the Writable if and suddenly text() doesn't work.

      You can use this as a replacement:

      record(Wallets,number('To Wallet')).Name = "OTHER"
      

      Since it is a dynamic choice you can get the Name with the record() command.

      I would submit a "ticket" with Ninox.

      • Ninox Developer
      • vermau81
      • 3 wk ago
      • Reported - view

      Thanks a ton Fred... record() solution worked. Please raise a ticket with Ninox so that they can solve this issue in their upcoming update.

      Thank you friends for all your valuable inputs..

    • Fred
    • 2 wk ago
    • Reported - view

    Here is what Ninox says:

    After looking over the database, the cause of this is that the field using text('To Wallet') renders before the select statement is complete, meaning it isn't populated. On the other hand, record(Wallets,number('To Wallet')).Name = “OTHER" directly accesses the data in the other table, and doesn't rely on the select statement running to completion first.

    This is partially down to how select statements work in Ninox, but our developers will be able to put measures in place to ensure this doesn't happen. I have created a bug ticket, in the meantime, thank you for bringing this to our attention.

      • Ninox Developer
      • vermau81
      • 2 wk ago
      • Reported - view

       First of all thank you heaps.

      I am sure there is some other logical reason that this is happening. It's quite rational that the choice field gets rendered on the form first and after that only get populated internally with the data coming out as a result of the SELECT statement written inside the field. That's why when we click on the drop down, we see the list of options to choose from.

      The problem lies somewhere with the "Writable If" property of the field. Looks like it is coded to support only hardcoded TRUE or FALSE or the record() function to fetch data from the table. There is no SELECT statement coded/written inside the "Writable If" property, unless the system converts the below statement into a SELECT statement implicitly.

      upper(text("To Wallet")) = upper("other");

      Or it looks like the listener/observer delegate for "Writable If" does not inform "Writable If" that it needs to execute it's code and check for the boolean result in the case of the above statement.

      Hope Ninox will fix this bug soon, 'cuz sending a call from the frontend to the table on the backend database server to fetch just one record to match the value of a column from that record is quite expensing in terms of database operations when we can just use the option available in the front end straightaway.

      I really appreciate your help as always in contacting Ninox support and bringing this up to their notice.

      Thank you very much helping close this open loop.

      Regards,

      Vermaji

      ---------------------------------------------

    • Ninox developper
    • Jacques_TUR
    • 13 days ago
    • Reported - view

    Doesn’t this seem to be exactly the same issue as in this topic? https://forum.ninox.com/t/h7ylp9m?r=q6yl0br