Forum Replies Created

  • I’ve figured it out!

    Because the .csv file inside AE is already broken up there is absolutely no reason at all to create row/column arrays. This makes the code actually fairly straight forward. Posting it here for anyone that may run into the same challenge.

    I also added a Slider Control to the .csv layer set to 999 and parented the .csv property “Number of Rows” to it. The reason is that this data doesn’t automatically update when more rows are added when the file is changed. Now it will always loop through the available max rows.

    csvFile = thisComp.layer(thisComp.numLayers).name;
    compName = thisComp.name;
    csvLength = thisComp.layer(csvFile)("Data")("Number of Rows");
    
    for (i = 0; i < csvLength; i++) {
      stringvalue = footage(csvFile).dataValue([0, i]);
      if(compName == stringvalue){
         footage(csvFile).dataValue([2, i]);
    	 break;
      }
    	else {"Data Not Found";}
    }

  • Thanks Tomas,

    I was already looking for ways to do that. I’m not the most savvy when it comes to coding so for loops are still a bit confusing to me. I actually tried to ask AI to come up with the code and got something like this (already modified the first vars to take the bottom layer of the comp for reading the csv file):

    compName = thisComp.name;
    csvName = thisComp.layer(thisComp.numLayers).name;
    rows = footage(csvName).dataValue.split("\n");
    
    for (i = 0; i < rows.length; i++) {
    col = rows[i].split(",");
    if (col[1] == compName) {
        result = col[2];
        break;
    }
    
    }
    result;

    But what I can’t seem to understand is how the .csv files work exactly since the cells are arrays of 2 dimensions but the actual data is also a string at the same time? When using the code AE says that the 3rd line is not a function. I can’t seem to figure out how to split the data.

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