How can I reference column name in a formula?
Or, really the same question, can I generate a list of column names of another table?
I feel like I may need multiple tables or something, that the spreadsheet approach is too foreign here.
This kind of concatenation has been very useful to me for various database imports, but maybe Coda has a better way to go around this.
Thanks for the suggestion @SK209. That would indeed work.
Alas - but thatās not why Iām posting here
It can always be hardcoded, but the question is how to pull the āpart_nā in programatically/ how to set it up for that.
Column names in Coda are some kind of identifiers, like variable name in programming language. It is not a good practice to change variable name dynamically, because other parts of the program may refer to it. Althought modern IDE allows you to rename variable in the entire program, this is still should be done before compilation or interpretation, by hand. Since Coda document is a program that re-interprets itself permanently, I think there is technically almost impossible to change column name from the inside.
And since you can change it only by hand, hardcoding method is pretty close to what you want in my opinion.
P.S. In your example on the screenshot column names are āA, B, Cā, not āpart1ā, āpart2ā, āpart3ā. For the program these texts are just a content of cells in the first row. So maybe your problem solves with some architectural changes, when this parts shouldnāt be āColumn namesā, but should be values of some property.
At the risk of being a bit presumptuous about the intention of the answers above (sorry @Denis_Peshekhonov and @SK209!), the short point is that if you run into this type of problem in Coda, thereās a good chance you should be restructuring your data (in this case, the āpartsā) so that it iterates across rows rather than across columns. Could you give a little more detail about the context of your example above? Iād be happy to work up an example to show you what I mean, but would like to understand a bit more about what you are trying to achieve (the very generic nature of the dummy data in the screenshot above makes the context a bit obscure).
Totally agree with @Tim_Sherman. Some more context into your exact requirements or use case would help us bring forth a solution that is compatible with Codaās database like structure.
Thatās fair. I felt that I probably need a different data structure, I am just not used to thinking this way. This use case should help me getting there.
Use case:
I have a system with objects that have attributes. Letās say objects are cars and attributes are color, make, special_power. I need to have the attributes as a comma separated list csv_attributes.
car = {
car_id : 111
color : red
make : honda
special_power : levitation
}
What I desire is a table in the end, that looks like this:
NOW, the question was how to do this without hardcoding the āattribute nameā. I want to either pull the attribute name from the column name, or I want to pull the column name from the attribute name. The point is I donāt want to be typing the attribute name twice anywhere. It should be only in one place. It can even be a table with Attribute Namesā¦ but then how can I make a column name correspond to thatā¦ Iām getting lost again
Outro:
Does this help illustrate the case?
Thanks for your suggestions!
Pretty clear, thanks! You problem is that you have external data format which you want transfer to. In ideal world I would give this job to an external module that uses API.
If you want to do it entirely inside document, there is the way. Your data structure is very similar to what non-relational databases do, e.g. MongoDB. Each record there has an unique indentifier _id, and the name of this field canāt be changed, but all other fields can: In this case field names are also part of data, not structure.
Thanks so much. I have to think about this some more. This certainly IS a real database now and it works and I really like the use of FormulaMap(). The downside is that I lose the ānormal spreadsheetā form altogether, which makes this more difficult as a middle man for import and export . Or at least if I want to copy paste. Maybe I can add another step of piping it into this form. Maybe itās time to API the spreadsheet into a databaseā¦ which of course Coda is. Iāll need to think some more.
Yes, this is one of the main drawbacks when you are choosing between relational and non-relational databases. Coda is definitely closer to relational style, but it needs more strict schema.
You are welcome )
P.S. There is now Integromat Coda integration, so maybe you can automate Coda->CSV transformation without writing your own program.