• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Passing layer sourceText into double quotes of an expression?

Explorer ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

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);
TOPICS
Expressions

Views

430

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

If you add .value to your first line:

 

colName = thisComp.layer("Type Col Name Here").text.sourceText.value;

 

you should be able to use colName without any quotes:

 

(colName)(colName + " 0")

 

 

Dan

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 24, 2020 Jun 24, 2020

Copy link to clipboard

Copied

LATEST

Thanks Dan!
For anyone else who find this, here's a screenshot of the code that eventually worked:

CSV Ref.JPG

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines