0

Add elements to a choice field

Hi to all

Is there a way to add, edit, delete elements in a choice Field through a formula?

ex.

Field 1 (formula field)

I assign values in a formula:

let x := "Napo"
let y := "Orso"
let z := "Capo"

etc.

and the result of the action of formula will be:

 

 

I know the elements in the Choice fields are beasts and do not work like records in the Table, and I wonder if someone has ever asked themselves this question, and solved it.

 

Thank you for your attention

5 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    If someone does not have administrator privileges, that would be very interesting, but....

    One solution would be to use 'dynamic' choice fields. You could then implement a formula to add records to the choice fields.

    Another way (trick) is to create a canban view using the choice field for viewing and in this view, options can be added, also by someone who doesn't have administrator rights.

      • francescostefanello
      • 1 yr ago
      • Reported - view

      RoSoft_Steven thanks to you

      One solution would be to use 'dynamic' choice fields. You could then implement a formula to add records to the choice fields.

      You mean by creating a new table and linking it to the Dynamic Choice?

      I would like something slimmer since I want to delete all the records every time, to recreate them, and this process done on a table takes more time.

      • Fred
      • 1 yr ago
      • Reported - view
       said:
      since I want to delete all the records every time, to recreate them,

       Well a dynamic choice is your only solution. A regular choice field can only be updated manually.

      That is interesting that you want to delete the choices and recreate them. Seems like that calls for a table anyways to keep track of the data. Plus once you select the choices, they will disappear once you delete the records so you will have to figure out to not delete the previous records. Unless you don't care of the selections anymore.

      • francescostefanello
      • 1 yr ago
      • Reported - view

       

      Thank you for your interest, Fred, I will now try to explain myself a little better.

      In the table A I have a button that, when clicked, performs the following instructions:

      for i in select Covers do
          delete i
      end;
      let xCurrRec := ID;
      let xtoken := 'Insert Your Token Here';
      let xReleaseNumber := 'Release Number';
      let url := "https://api.discogs.com/releases/" + xReleaseNumber + "?token=" + xtoken;
      let response := http("GET", url, {
              Authorization: "Bearer " + xtoken,
              'Content-Type': "application/json"
          });
      let images := response.result.images;
      for i in images do
          let myRecord := (create Covers);
          myRecord.('Release Number' := xReleaseNumber);
          myRecord.(Type := i.type);
          myRecord.(ImageURL := i.resource_url)
      end
      

      As you can see, it makes an API request to download the links of the covers of a release. Those links are assigned as values to the table B that is connected to my choice field.

      When the choice field is modified, a trigger is activated that assigns the value of the choice to another field (coverimage2).

      There is also a formula that uses HTML and through that link assign the image to an image field of the Table A.

      The records in the table have to be deleted and rewritten each time because the covers are different for each release.

      So when I move to the next record of table A, the procedure needs to be repeated and table B needs to be updated with new values requested through an API.

      I hope I have explained myself well, English is not my native language.

      • Fred
      • 1 yr ago
      • Reported - view

      That is some very nice coding.

Content aside

  • 1 yr agoLast active
  • 5Replies
  • 118Views
  • 3 Following