0

Dynamic Choice/Multi-Choice

Hello,

 

Is it possible to add a list item to a dynamic choice within the Dynamic Value code section?

 

For example, I have: 

(select Building where Entity = ent) order by Entity.Name and 'Building Name'

But I want to add an additional option that is not actually in the Building table. 

7 replies

null
    • Fred
    • 2 mths ago
    • Reported - view

    What is the other option you want to add?

      • SMoore
      • 2 mths ago
      • Reported - view

      Hi

       

      Always good to hear from you. I want to add “All Buildings” as an option. 
       

      I understand I can create a building named “All Buildings” and adapt my code to check for that, but I wanted to give it a try adding an item dynamically in the code. 
       

      I wish there were more documentation on Dynamic fields. The documentation only outlines using other tables, so it may not even be possible. Though, while it is getting much better, the documentation still doesn’t seem to address the full capabilities of Ninox. 

      • Fred
      • 2 mths ago
      • Reported - view

      Since dynamic fields are based on tables, I wish they could also be JSON based, you will need to add a record called All Buildings and somehow mark it to show up in all your filters. Then, as you say, use a trigger after update that looks for the selection to actually select all buildings.

      On a side note, can you use the Entity relationship to get the buildings you need instead of doing a select? I see that you have somehow selected an Entity record in the table you have this dynamic field in (with the ent variable). In the Building table you have an Entity field as well, so instead of a select can you use the Entity relationship to get to Buildings?

      • SMoore
      • 2 mths ago
      • Reported - view

       thanks for the confirmation. Populating with JSON would be fantastic. It would open the ability to populate menus from other systems utilizing REST API. 

      I ended up creating a Boolean field inside of Buildings named 'int_sys_record', that when true the Building record is ready-only and cannot be deleted. So, I created 'All Buildings' that way. 

       

      Then in my Dynamic field, I

      order by int_sys_record = true or Name

       

      I do realize I can also utilize a multi-choice record, but that is not how I wanted to program this particular field. 

       

      Lastly, I do realize that I could create direct N:N relationships and the logic would be a bit simpler. I am just trying to get more comfortable with dynamic fields, and creating relationships dynamically. 

      "Multiple ways to skin a cat"

       

      Best,

      S Moore

      • Ninox partner
      • RoSoft_Steven.1
      • 1 mth ago
      • Reported - view
       said:
      I wish they could also be JSON based

        I believe this will be part of the upcoming 3.14 release.

      • Fred
      • 1 mth ago
      • Reported - view

      Wow, that would be awesome. I haven't heard anyone talk about this yet.

      • szormpas
      • 1 mth ago
      • Reported - view

        Hi,

      This is great news! Being able to show the results of an API call in a dynamic multiple choice field instead of saving them in a table will make things faster and easier.

      We are looking forward to this!

Content aside

  • Status Answered
  • 1 mth agoLast active
  • 7Replies
  • 77Views
  • 4 Following