While aliasing and naming would work better from a formal / coding perspective, I do agree with @Paul_Danyliuk that the coloring is already a convention for competing variables so why not re-use it?
Second this.
Coloring is great to identify the scope, event though itās currently broken with nested functions. But I assume that would be fixed.
Just to throw in another idea, in addition to coloring, you could think of appending the formula name to it, e.g. ....FormulaMap(...Filter(currentValueFilter = currentValueFormulaMap))
I also agree this is the best solution. However, one way that it might lead to frustration is in copy-pastingā¦ ideally the level of [currentvalue] would be kept when copy-pasting formulae.
Copy-pasting doesnāt work reliably anyways. I think itād be a fair tradeoff.
BTW for the record, hereās a workaround solution I documented elsewhere. Past due it belongs in this topic:
I want to bump this. Just came up for me. I am trying to emulate the output of a Pie Chart, which does this type of thing as part of its default function ā¦ I want to be able to get an array of all the āpie percentsā.
+1 to Option 1 @shishir
I too am struggling with the need of being able to do FormulaMap(SomeOtherThing.filter(OUTER_CURRENT_VALUE_NEEDED_HERE))
P.S. Re copy-pasting. I think internally in Coda references in formulas are copy-pasted by their full $$[]
descriptors, not just the names. And itās just the names when you paste it outside of Coda. My point is, correct CurrentValue
s may actually stay preserved when copying formulas within Coda.
More about the $$[]
operator:
Sorry if Iām hijacking this thread, but maybe thereās a way here I havenāt thought of
Where Iāve hardcoded āLinnĆ©aā, Iād like to use the CurrentValue from the FormulaMap. Is there a way?
Edit: It wasnāt clear in the screenshot, but there can be multiple assignments (and members working) on any given day
My 2 cents on this topic, while having multiple CurrentValue
's in this list and highlighting the matching scope with coloring/bold is a nice UX consistent with the current webapp, I believe that an explicit solution is required - certainly at the server API level.
So why not just focus on that first, and roll it out to the UI level as well as a first pass?
So something like :CurrentValue
or some other āescapingā character (like ...
for file systems) to refer to the outer scope(s), as mentioned earlier as a possible solution.
I donāt see how to get around the need for explicit syntax - the other solutions are just syntactic/visual sugar to layer on top of this.
Can you please share the doc here or with just me actinarium@gmail.com? I think thereās a way around this.
E.g. if you pull in all assignments for a user, you can rewrite your FormulaMap as:
Members.FormulaMap(List(
CurrentValue.Name,
CurrentValue.Assignments.Filter(Date = thisRow.Date).Load.Sum()
))
I think you might be on to something, we just have to filter by task start and end date instead. I thinkā¦
Look at Workload Lab section:
Iāll look a bit later ā going to be super busy rn.
Not sure whatās happening here, why canāt I access the Assignments columns after the Filter() call?
thisRow.Members.FormulaMap(
List(
CurrentValue.Name,
CurrentValue.Assignments.Filter(
AND(
Start<=thisRow.Date,
End>=thisRow.Date
)
)
)
)
edit: Itās as if Filter() returns Members.Assignments.[Project task]ā¦
Itās unclear to me exactly what youāre after. But hereās one approach that might give you some ideas.
Hey, @Ander, thanks for giving this a shot! Interesting with how you use Sequence and Nth, I did not know one could construct loops like that. Your approach is close to what I want, I want the sum of load per assignment, per user. As in: Stefan: 125%, Pontus: 50% etc. Youāre close but I donāt get how to modify your column 8 to give that result.
Using Sequence and Nth, I managed to solve it
Sequence(1, thisRow.Members.Count()).FormulaMap(
List(thisRow.Members.Nth(CurrentValue),
thisRow.Members.Nth(CurrentValue).Assignments.Filter(
AND(Start<=thisRow.Date,End>=thisRow.Date)
).Load.Sum()
)
)
Thanks @Ander for giving me a way to the solution!
Eh, hey @Ander, youāve modified your document afterwards, right? Since I can now see what I was going for in it?
Yes, I cleaned it up for future reference. Nice work solving that. I learned a new technique, thanks!
But was the solution (The bulleted list in Member Load) there when you first shared it? Did I miss it? Shame on me in that case!
No no, it came after.