Data Entry from Layer Name

Parse key:value pairs from a layer name for structured data-driven text.

Expression Code

// Data Entry from Layer Name
// Name your layer: "Title: My Project | Date: 2024 | Client: Acme"
name = thisComp.layer("Data").name;
parts = name.split(" | ");
// Find the value for a specific key
key = "Title";
result = "";
for (i = 0; i < parts.length; i++) {
  if (parts[i].indexOf(key + ":") == 0) {
    result = parts[i].split(": ")[1];
  }
}
result;
Create a layer named "Data" and format its name as key:value pairs separated by " | ". Apply this expression to Source Text and change the key variable to pull whichever field you need — "Title", "Date", "Client", etc.