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!

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Sean
    • Sean
    • 3 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.

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

    Like
    • 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 :)

      Like
Like Follow
  • 5 mths agoLast active
  • 3Replies
  • 1483Views
  • 1 Following