It would be great to be able to reference columns with procedural strings.
When you have a large number of columns but with predictable names, this would be very useful.
I’ll try to explain the use case for clarity.
Let’s say we have these columns.
Column 1
Column 2
Column 3
I’d like to be able to do: thisRow.(Concatenate("Column"," 3"))
That would give me thisRow.[Column 3] but I currently can’t make it work.
I suppose I could change the topic title to “Reference Object Name with String”, columns are one of the use cases.
A possible solution would be to make brackets usable like this thisRow.[(Concatenate("Column"," 3"))]
But I get the feeling that if it was that simple, the Coda team would have done it already. Things are much more complicated behind the scenes, I can barely imagine.
Another solution would be to have a specific function like ToObject or ToColumnName thisRow.ToColumnName(Concatenate("Column"," 3"))
I really like the idea of ToColumnName to be explicit about wanting to turn a string into a column name reference. I actually don’t think this is too complicated, but rather if implemented incorrectly could cause a lot of confusion for novices. That is why I like the idea of ToColumnName, because it is explicit, and would only be used by people who really know what they want.
Thanks @Dalmo_Mendonca!
I didn’t mean to imply that there are no solutions. Switch would be the way to go right now indeed. But this will get very cumbersome very quickly if you have many columns.