Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions using “.length” on a csv field

  • using “.length” on a csv field

  • Chris Voelz

    July 7, 2020 at 10:54 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

  • Dan Ebberts

    July 7, 2020 at 11:08 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;


  • Chris Voelz

    July 7, 2020 at 11:36 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.

Viewing 1 - 3 of 3 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy