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

Changing an AttributeDef type

Community Expert ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

Hi All,

I have a "product" attribute on an element that is set as a String in the EDD. I want to dynamically change it to a Strings type in the document. I have some code I have been playing with, but it is not quite ready for the world to see--and besides, it doesn't work. Has anyone done a task like this in ExtendScript or the FDK that could share some pointers? Thank you in advance.

-Rick

TOPICS
Scripting , Structured

Views

117

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
Explorer ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

LATEST

Hi,

 

I've not tested this, but it will be something like this:

var elemDef = app.ActiveDoc.GetNamedElementDef('FooBar');
var attrDefs = elemDef.AttributeDefs;

for (var i = 0; i < attrDefs.length; i++) {
	if (attrDefs[i].name === 'product') {
		attrDefs[i].attrType = Constants.FV_AT_STRINGS;
	}
}

elemDef.AttributeDefs = attrDefs;

Votes

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