0

multiple choice: delete option and set option on create new record

I'm sure that until recently it was possible to delete a row from the options of a multiple choice field. Now I can only edit the text and re-order the options. Is it me or has something changed?

Also I've been trying to set initial options for mc field as part of a "trigger on new record" action. This does not seem possible, although I can do it by adding the same code to an after update action.  Any ideas on how to force an opening value(s)  to an MC from an on new record action?

8 replies

null
    • Fred
    • 3 mths ago
    • Reported - view

    I'm sure that until recently it was possible to delete a row from the options of a multiple choice field. Now I can only edit the text and re-order the options. Is it me or has something changed?

    If it is a simple multiple choice (MC) field, there is only one way to edit the choices and that is to manually edit the choices.

    If it is a dynamic MC field, then you can just change which records you gather.

    Also I've been trying to set initial options for mc field as part of a "trigger on new record" action. This does not seem possible,

    To set MC field (simple or dynamic), you only need to build an array of the numeric choices. For simple MC fields, the choice number is what is shown in the Edit Field. In dynamic MC, the choice number is the record Id.

    If you had a simple MC with 5 choices and want to set choices 1 and 4 on every new record you can do:

    multichoicefield := [1,4]
    
      • Chris_Mullett
      • 3 mths ago
      • Reported - view

       Thanks Fred. I was not clear regarding the deletion of an option. I mean in maintenance mode. If you create an MC with 7 options, then decide only 6 are required how is one option removed?  Screen shot shows an example created a while ago with no option 1. This was deleted, I think, by clicking a bin icon, but there doesn't seem to be a way of doing this now.

      With regard to setting initial values for an MC I've uploaded a simple DB illustrating my problem. Table 1 has a MC field and a relationship to table 2, which also has an identical MC. On creating a new record in table two I would like the on new action to copy the values of T1MC to T2MC. It doesn't happen. Clicking on the Button on T2 does it. Why doesn't the on new work?

       A puzzle?

      Cheers

      Chris

    • Fred
    • 3 mths ago
    • Reported - view
     said:
    I think, by clicking a bin icon, but there doesn't seem to be a way of doing this now

    It has been awhile since I tried to delete choices. You click on the name and then you will see a trash can icon.

     

     said:
    On creating a new record in table two I would like the on new action to copy the values of T1MC to T2MC. It doesn't happen. Clicking on the Button on T2 does it. Why doesn't the on new work?

     You got very close. You wrote:

    MC1 := Table1.T1MC
    

    Great use of relationship fields to get your data.

    Now to your issue. Like I said earlier, you need an array of numbers.

    If you create a new formula field in Table2 and put this in it:

    debugValueInfo(Table1.T1MC)
    

    you will see something like, depending on the selections made:

    multi("3")

    That is not an array of numbers. To fix this you just need to use the numbers() command. So if you change the new formula field to:

    debugValueInfo(numbers(Table1.T1MC))
    

    you should see something like:

    number([1,2])

    Now that is an array of numbers. So then you can change your button to:

    MC1 := numbers(Table1.T1MC)
    

    And it should work.

      • Chris_Mullett
      • 3 mths ago
      • Reported - view

        This is weird. On my app clicking on the option does not show bin icon, see screen shot. 
      It does work on the sample app I uploaded.
      The button woks fine on the sample app as is without the debug code. I've added the this:

      #{MC1 := Table1.T1MC}#;
      let myArray := debugValueInfo(numbers(Table1.T1MC));
      alert(myArray);
      MC1 := myArray
      

      to the trigger on new, but still does not work. The alert just reports an empty array number([]).

      • Fred
      • 3 mths ago
      • Reported - view

      The debugValueInfo is not supposed to be in your button code. See my post about how to use it. See the post to how to update the button.

      When you say "app" are you talking about MacOS, iOS, or android app?

      I don't know what is up about not having the trash can icon. I tried it in MacOS and I'm able to see the trash can.

      • Chris_Mullett
      • 3 mths ago
      • Reported - view

       Thanks Fred. I have no problem with the button code, I understand it and it works, but I am trying to get it to work from the on new trigger. I have been working on a Ninox db for a while on  MacOS and am just adding some final polish. The db I uploaded just illustrated what I was trying to do. I've looked through my db again and it is only this MC which doesn't have the trash, must be a minor corruption. Other MCs have the trash. I will export data from the MC field to a function field, delete the MC and rebuild it and reinstate the data from the function field.

      The question is really how to set the MC field as part of the code in an add new record trigger. It doesn't seem to work.

      Thanks for your help with this.

    • Fred
    • 3 mths ago
    • Reported - view
     said:
    The question is really how to set the MC field as part of the code in an add new record trigger. It doesn't seem to work.

    If you are initiating from table2 then it is doing exactly what you want. The problem is the link to table1 has not been established. If you create the new table2 record from table1 then it will work fine.

      • Chris_Mullett
      • 3 mths ago
      • Reported - view

      Ah, that makes sense. I'll rejig and see how I get on. Thanks again.

Content aside

  • 3 mths agoLast active
  • 8Replies
  • 42Views
  • 2 Following