0

how can I remove an item from an array?

I have found idxRemove() but unable to make it works...

let say: let A := sort((select Achats).total_vente);

idxRemove(A,2) tell me that the function not defined...number...

Thanks!

3 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    Ahh, one of my favorite topics on the Ninox forum 馃槒. idxRemove() is a User-defined function that must be defined in a formula field before it is used or defined in "Global script definitions". You also have to use the concat() function because arrays can't be passed as arguments to a User-defined function so once it's defined you would use it like this...

     

    idxRemove(concat(A), 2)

     

    You can also use the unique() function combined with the slice() function both of which are built in Ninox functions, but if you have any duplicate information in the array it will be removed.

    • plafontaine44
    • 4 yrs ago
    • Reported - view

    thank you! but how do I define it in formula field...not sure to uderstand!

      • SvenSteffen_Arndt
      • 1 yr ago
      • Reported - view

      plafontaine44 

      from the documentation:

       

      Examples

      slice(array, start, end) To extract a sub-array. Start and end are zero-based.

      1

      slice(["Apple","Bagel","Cake","Donut"], 1, 3)

      Result: Bagel,Cake

       

      When you take the result of slice as the original array you deleted something out of it :)

Content aside

  • 1 yr agoLast active
  • 3Replies
  • 1593Views
  • 1 Following