ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

using ".length" on a csv field

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Voelz
using ".length" on a csv field
on Jul 7, 2020 at 10:54:39 pm

This is driving me bonkers and I have not been able to find any documentation online. I have a csv that I am using to drive a bunch of assets including the Source Text of many layers. The actual input of everything works like a charm, but the included expression does not work for my "day.length". The ".length" works on column 0 and 1, but anything past those 2 it will not read the length. I have tried reconfiguring the data file but anything past 2 columns and the length can not be read. I am assuming it is how AE is reading the csv with a single digit number. The expression as is works, I just need help getting AE to read the length of dataValue[2,3].

I could reformat the csv but that would require quite a bit of expression changes in my project.

*Less than symbols weren't displaying properly for the following lines.
M = ((mon.length) < 2) ? ["0"+mon] : [mon];
D = ((day.length) < 2) ? ["0"+day] : [day];

mon = footage("Text Source.csv").dataValue([1,3]);
day = footage("Text Source.csv").dataValue([2,3]);
year = footage("Text Source.csv").dataValue([3,3]);
M = ((mon.length) &lt; 2) ? ["0"+mon] : [mon];
D = ((day.length) &lt; 2) ? ["0"+day] : [day];
M + " / " + D + " / " + year


Return to posts index

Dan Ebberts
Re: using ".length" on a csv field
on Jul 7, 2020 at 11:08:44 pm

Hard to say without seeing your data file, but is it possible that those values are already numbers, and not strings? If so, maybe this would work:

M = (mon < 10 ? "0" : "") + mon;


Dan



Return to posts index

Chris Voelz
Re: using ".length" on a csv field
on Jul 7, 2020 at 11:36:03 pm

Your recommendation worked (like I should ever doubt your advice). My head was in the gutter and I didn't even consider reading the datavalue as a number...duh. *facepalm. I've been so fixated on the idea that I was importing "text".

Thank you thank you thank you! This was the last thing I needed to fix.


Return to posts index

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