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

One-to-many relational manipulation of pathItems

Explorer ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

I am in need of a reliable solution to manipulate pathItems in a one-to-many relationship similar to that of how a relational database works. I am open to any method as long as it adheres to the following requirements:

 

  1. The parent pathItem (“File 1”) must reside in a separate layer with unknown layer hierarchy
  2. Exclusion of all other pageItems that are not pathItems
  3. The relational aspect of the pathItems would ideally be hidden from the end-user
  4. Names (pathItem.name) need to remain unchanged although could be temporarily manipulated
  5. “Assets” layer is to remain locked and will always be a top-level layer
  6. “Assets” layer pathItems (“File 1 Asset 1” and “File 2 Asset 1”) will always be hidden

 

Screenshot 2025-01-31 at 10.14.57 AM.png        Screenshot 2025-01-31 at 10.51.13 AM.png

 

My current workflow generates unique ID numbers and assigns them to the parent pathItem and children automatically. My approach is to use hidden tags using the following method:

 

 

 

// method to add hidden tag
var pathItemTagID = selectedItem.tags.add();
pathItemTagID.name = "pathItemID";
pathItemTagID.value = pathItemNumber;



// method to create ID pathItemNumber
var pathItemNumber = generateRandomNumber(1, 1000);

function generateRandomNumber(min, max) {
  var randomValue = Math.random(); 
  var randomNumber = Math.floor(randomValue * (max - min + 1)) + min;
  return randomNumber;
}


// methods for accessing the hidden tags:

alert("<<<  ID Match  >>>\n\n" + selectedItem.tags.getByName("pathItemID").name + "\n\n" + selectedItem.tags.getByName(“pathItemID”).value);

alert("<<<  ID Match  >>>\n\n" + selectedItem.tags[0].name + "\n\n" + selectedItem.tags[0].value);

 

 

 

To keep things simple all I need is the ability to delete pathItem (“File 1”) in the “Working Files” layer and consequently all of the related child pathItems (hidden or locked) in the “Assets” layer (“File 1 Asset 1”, “File 1 Asset 2” and “File 1 Asset 3”). I am in the hopes that this topic would be of value to others as well.

 

TOPICS
How-to , Scripting

Views

59

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
no replies

Have something to add?

Join the conversation
Adobe