How to get, in Toddle, the equivalent of filterByKey(BigArray, 'name',map(SmallArray,'value'))

  • laetitiamassa-1314275185523949629

    Laetitia | Pinshasa

    4 months ago

    I'm trying to get a subset of a list of products, Toddle AI tells me to use filter and match and map, but I can't figure out how to properly use all three (in particular: where to insert "Matches")

    In the image,
    - BigArray = Products,
    - SmallArray = Product
    - the node Size is just to check the output (the array should be of 4 items, but I still get 290 as output - so nothing is filter)

    (PS : I tried before with includes, etc. but as my database doesn't provide a common id for each item of the SmallerArray, it can't work with a simple Includes here)
    1314275186396102737-Capture_decran_2024-12-05_a_17.56.19.png
  • lucasg-1314307932883648512

    Lucas G

    4 months ago

    It would help to know how the data is structured
  • In your screenshot, map wouldn't work
  • The filter node expects a bool response for the formula
  • lucasg-1314308352641339564

    Lucas G

    4 months ago

    Use map to create a new array from your data
  • Filter is used to filter out items that match a certain formula

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!

© Copyright 2024 toddle. All rights reserved.