PricingBlog

Repeat Size

  • kamilnader-1211344141099733064

    Kamil

    1 year ago

    Hello, I am using repeat on a component. I wonder if there is a simple way to save the size of repeating components into a variable without the use of custom code. Thank you.
  • kamilnader-1211345067835396116

    Kamil

    1 year ago

    Also the repeating formula is filtered so it's not the same size as from API.
  • lucasg-1211348736534511706

    Lucas G

    1 year ago

    By size do you mean like min-width/height type of thing?
  • You could probably use style variables for it
  • kamilnader-1211349144896143361

    Kamil

    1 year ago

    Hey @Lucas G, thanks. Sorry, I meant length of objects in a repeating array. I write size because Toddle is using size in the formula.
  • lucasg-1211351321592995922

    Lucas G

    1 year ago

    What are you trying to accomplish?
  • If you want a specific amount of items from an array then you could use the Take node and specify the number you need
  • kamilnader-1211353980433604719

    Kamil

    1 year ago

    @Lucas G Let me try to explain differently. So I have an API, which I use to repeat components based on the objects in an array. That repeating formula contains a filter, that changes the repeating array based on the query params. All I want is to get the length of that repeating array and save it to a variable.
  • yoelfdz-1211354610649006111

    yoelfdz

    1 year ago

    Do you mean you want to know how many repeated items you'll have as a result of the filter? Have you checked the Size formula?
  • kamilnader-1211355052141445140

    Kamil

    1 year ago

    That's right. I wanted to use size, but where?
  • Tod-1211355053684826144

    Tod

    1 year ago

    Great energy @Kamil! Your continuous contribution to the toddle Community just made you advance to Community Level 5!
  • lucasg-1211356070988218419

    Lucas G

    1 year ago

    You'd just use the Size node with your filtered data as the input
  • yoelfdz-1211356553383387277

    yoelfdz

    1 year ago

    If you need to know the size without changing the repeated array simply create a new variable or a custom formula and connect the array and the size node as Lucas has pointed out
  • kamilnader-1211358659775561769

    Kamil

    1 year ago

    Thanks. So what I did is create a new custom formula and then copied the whole repeated array formula and added size at the end. I know about this, but I was hoping there was something that could be done directly on the component. However, as long as it works, it's fine.
  • yoelfdz-1211358754147401879

    yoelfdz

    1 year ago

    Here is an example to set a style variable to a % width so all items have the same width inline using the Size node
    1211358753924976710-Captura_de_pantalla_2024-02-25_a_las_18.05.22.png
  • yoelfdz-1211359058603278416

    yoelfdz

    1 year ago

    Also, it can get messy to copy paste complex formulas, would suggest creating a custom formula and just use that on both sides for simplifications + if you make changes in the future, those will be applied everywhere the formula is used
  • Tod-1211359060096581705

    Tod

    1 year ago

    Great energy @! Your continuous contribution to the toddle Community just made you advance to Community Level 4!
  • kamilnader-1211359199213260911

    Kamil

    1 year ago

    That's a nice trick👍
    ❤️1
  • kamilnader-1211359935393304616

    Kamil

    1 year ago

    Yes, I will go in this direction. The formula is so large that the lines connecting nodes stopped showing😄
  • yoelfdz-1211360265988218900

    yoelfdz

    1 year ago

    Oh wow, you better have a big screen hahaha
  • kamilnader-1211360730020978779

    Kamil

    1 year ago

    Unfortunately, it is still too large on a 49-inch screen 😅
  • lucasg-1211362281871380500

    Lucas G

    1 year ago

    Might need to split that formula into chunks if it is that large
  • That would be an insanely big formula
  • I need a screenshot lol
  • yoelfdz-1211362482417836093

    yoelfdz

    1 year ago

    I'm curious too
  • kamilnader-1211364155702116432

    Kamil

    1 year ago

    Fullscreen screenshot:
    1211364155416776734-Sizzy_2024-02-25_at_6.27.51_PM.jpeg
  • and down it goes😂
  • for some reason I don't have lines if it is not fullscreen:
    1211364426196717658-Sizzy_2024-02-25_at_6.26.56_PM.jpeg
  • yoelfdz-1211365723335561268

    yoelfdz

    1 year ago

    omg, you may also use a Size node to count the conditionals there 😜
  • kamilnader-1211365918089678899

    Kamil

    1 year ago

    Hahaha🤫
  • kamilnader-1211366225226244096

    Kamil

    1 year ago

    I wanted to do with map, but I need additional methods that are not yet available