ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Passing layer sourceText into double quotes of an expression?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew Marston
Passing layer sourceText into double quotes of an expression?
on Jun 23, 2020 at 4:17:55 pm
Last Edited By Andrew Marston on Jun 23, 2020 at 4:18:15 pm

I'm building a template to display data from a csv. The user will type the name of a column into a text layer, and this string is passed into the expression to display data from this column. However I can't figure out how to pass the sourceText of the text layer into the csv reference expression. I suspect I'm just using double and single quote wrong, but can't seem to get it. Any idea how to pass a string into the double quotes of an expression?
colName = thisComp.layer("Type Col Name Here").text.sourceText;
thisComp.layer("Population2019.csv")("Data")("Outline")("'colName'")("'colName'" + " 0").value);


Return to posts index

Robert Müller
Re: Passing layer sourceText into double quotes of an expression?
on Jun 24, 2020 at 10:34:37 am

Hi Andrew,
No quotes for variables my friend 😉
colName = thisComp.layer("Type Col Name Here").text.sourceText;
thisComp.layer("Population2019.csv")("Data")("Outline")(colName)(colName + " 0").value);


Return to posts index

Andrew Marston
Re: Passing layer sourceText into double quotes of an expression?
on Jun 24, 2020 at 5:31:21 pm

I see. The final expression referencing the CSV seems to need quotes to navigate the data tree. When I try with and without quotes I get an error though. :-/ Here's a screenshot of a stripped version of this section of the project:


Return to posts index


Andrew Marston
Re: Passing layer sourceText into double quotes of an expression?
on Jun 24, 2020 at 5:36:08 pm

Oh! Nevermind. After removing the quotes from the source text and fiddling with how I was adding the space+i I was able to get it. For anyone who find this with a similar question, here's a screenshot of the final code that's working:


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]