I have this list of lists:
List(1, List("A", "B", "C"))
How can I turn it into:
- 1
- A
- B
- C
Can the same formula be made to work for:
List(2, List(1, List("A", "B", "C")))
I have this list of lists:
List(1, List("A", "B", "C"))
How can I turn it into:
Can the same formula be made to work for:
List(2, List(1, List("A", "B", "C")))
Yes this is the desired output, but I want both examples to be solved using the same formula.
thatâs a little âroughâ request from a community champâ ⌠!
At this point, did not figure out how to perform this without switchif (knowing that Iâm cheating )
Will your data always have that kind of format ? if yes I assume this switchif isnt such a bad idea, but otherwise itâs difficult to me seeing how to cut the list, knowing how many levels of bullet point I would require.
Slicing/spliting the list and you loose the information about sublist. Using First/Last makes me loose middle data from example 1. Then, calling for better coda maker and wizard than me on this subject
Is using a button an option, or does it have to be a live formula?
With a live formula this can be possible with some forced recalc magic to get it into a recursive loop.
Iâd also say maybe make a pack formula for it?
Hey Paul. Yes I also tought of a button that could make it easier. Thanks for sharing the while loop in live formula, could totally interest me for another project. Cheers.
Yeah pack is probably the move. I just really wanted to do it in native formulas.
Thanks to all, youâre helping me feel less dumb for not being able to figure it out.
Ok if it canât be in a simple formula, maybe it can be in a table formula.
Hereâs the doc Iâm working in:
Youâll see that there is a column called Subitems which nicely shows what an Item is made of:
Iâd like to be able to @ reference that Basket and see its makeup in a bulleted list like this:
The tableâs rather easy, and I might have a wild idea with just random lists of text as well (provided all text pieces are unique). Itâs too late here though; Iâll update this post when Iâll have solved it in my tomorrow.
Sorry, got busy for a few days.
Hereâs the table solution: recursive collection of data from items:
With regular text itâs a bit tricky because Coda tried to âfixâ the one vs list-of-one issue with another âmagicalâ behavior where the list of one is silently treated as an item on its own:
The crazy approach Iâd use here to determine whatâs the level of the nesting of each given item is to⌠convert the list to text and calculate nesting by taking the number of [
s and ]
s and subtracting one from another Of course this wonât work if the items themselves have []
characters (although it can be worked around with smarter regex) and if one item appears elsewhere, e.g. âCheeseâ and âCheese sticksâ might trigger faulty results because of a substring being found twice
WithName(Input + "", InputToText,
Input.ListCombine().ForEach(
InputToText.Find(CurrentValue).WithName(FoundPosition,
InputToText.Left(FoundPosition).WithName(AllPreText,
List(
AllPreText.RegexReplace("[^\[]", "").Length() - AllPreText.RegexReplace("[^\]]", "").Length(),
CurrentValue
)
))
).ForEach(
CurrentValue.Last().BulletedList().IndentBy(CurrentValue.First() - 1)
).Concatenate()
)
Update: Fixed this by wrapping the list into an object first. This way Coda preserves the lists properly (turns it into proper JSON):
This is super useful Connor! (For some reason, the second video on the Items page is not working for me.)
Glad itâs helpful! Can you tell me about the issue youâre running into with the second video? Iâm not able to replicate the issue
Yeah, the bulleted list issue was causing me problems. Why does BulletedList do that? Is it for any good reason or just a bug?
The solution should not be this complicated
Hi Connor, The video doesnât play on my end, but it could just be an issue for me.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.