0

Choice (dynamic) Combobox Behavior

Is there a method to tweak the behavior of the Choice (dynamic) Combobox such that either

     1 - an option can be selected from the dropdown list
          - OR -
     2 - new text not found in the dropdown list can be typed in the box

and either will be accepted as the entered value for the field.

If not, has anyone found a way to simulate this behavior?

Thanks

6 replies

null
    • Fred
    • 6 mths ago
    • Reported - view

    Sadly there is not anything built into Ninox that allows updating of the dynamic field reference table through the dynamic field. It is a one way street where it only gets data from the table.

    Maybe you can have a choice/record called "Other" that when selected:

    a field and button appears that allows the user to enter in the new data and then the button creates the record and then sets the dynamic choice to be the newly created record.

    • Global Information Technologist
    • Miken
    • 6 mths ago
    • Reported - view

    Thanks Fred - I was hoping my inexperience with Ninox had me overlooking something. I had to do a work around similar to your suggestion in a Csharp app using Sycfusion which at the time had a similar dropdown not being a true combobox (combined textbox and dropdown that functions as above).

    Playing with it briefly, a Yes/No that triggers a Choice (dynamic) to become visible for use via Display field only if, seems to work pretty good. Next just have to get the selected item text in the Choice (dynamic) back (via Trigger after update) to the target textbox. Right now it returns the selected position integer.

    Tomorrow I'll post a little Sandbox app here that demonstrates the concept. Maybe some folks with  deeper experience will come up with a more eloquent solution. I'm only a few days old with Ninox.

    • Global Information Technologist
    • Miken
    • 6 mths ago
    • Reported - view

    Attached is a db first pass at simulating the function of a traditional combobox where the user can either select an entry from a dropdown OR type in a new value.

    One of the key elements of the Choice (dynamics) is the dropdown options are generated by pulling the unique entries from the corresponding data field.

    Currently it ain't pretty but it works except that when an option is selected from the dropdown, the position integer is written to the textbox instead of the selected text.

    Any suggestions for improvement are appreciated.

      • szormpas
      • 6 mths ago
      • Reported - view

         Hi, put the following code inside 'UnitSelector' Trigger after update option:

      let x := number(UnitSelector);
      Unit := record(Sandbox,x).Unit
      
    • Fred
    • 6 mths ago
    • Reported - view
     said:
    Currently it ain't pretty but it works except that when an option is selected from the dropdown, the position integer is written to the textbox instead of the selected text.

    "it ain't pretty" is my middle name. 😄

    Anyways, to get just the text of a choice field you can use the text() command. So the trigger code would look like:

    Unit := text(UnitSelector)

    I see that you build the dynamic choice by looking into the same table and grabbing the first record of each unique value in Unit. I'm not sure how scalable that is.

    Plus, to me, the flow seems backwards. I would want to use the choice field first and only manually enter in data if it is not already there.

    Another way would be to create another table that stores all other options. Then use that to build your dynamic field. Then add a button to make sure a user really wants to add the new unit. The code does not check to see if the new value already exist but that can be added.

    Attached is how it could work. It is weird but I tried setting the dynamic choice to the new record but it didn't work. I had to find the record again then it would set properly.

    • Global Information Technologist
    • Miken
    • 6 mths ago
    • Reported - view

    Sandbox modified to use Fred's - Field:= text(FieldSelector). Works perfect.

    I'm actually attempting to convert a simple csharp repetitive data collection app over to Ninox. The way that app works you select a past record like the one you want to record, it opens it. You hit copy, and all the fields are copied to the new record except the timestamp and gps location are automatically updated to present. The cursor then sits in the Reading field ready for entry. So the process above is really only used when you create a new type of record.

    It is used for highly repetitive manual entry. I have had folks use it for anything from inventory, health history to journaling. I even had a guy use it for bird watching. Data exports to csv so you can do what you want with it.

    I have enough now to beta it in Ninox. I'll post it over in the Learn Share area. Maybe turn it into a community project.

    Thanks everyone.

Content aside

  • 6 mths agoLast active
  • 6Replies
  • 83Views
  • 3 Following