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. 

4 replies

null
    • Fred
    • 2 wk ago
    • Reported - view

    What is the other option you want to add?

      • SMoore
      • 2 wk 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 wk 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 wk 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

Content aside

  • Status Answered
  • 2 wk agoLast active
  • 4Replies
  • 43Views
  • 2 Following