setAttribute method: Feed class
Syntax
setAttribute(attribute_ID, Value, XML)
Description
Use this method to set the properties of a feed attribute. If the attribute ID does not exist, then a new attribute is created. If both Value and XML are empty, the attribute is deleted.
Parameters
| Parameter | Description |
|---|---|
|
attribute_ID |
Specifies the ID of the attribute as a string. |
|
Value |
Specifies the value of the attribute as a string. Use Value for translatable values such as the copyright and so on. |
|
XML |
Specifies the XML value of the attribute as a string. Use XML for nontranslatable values or values longer than 254 characters such as a URL. |
Returns
An Attribute object.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Attribute;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", ⇒
&thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Attribute &logo;
If &thisFeed <> Null Then
&logo = &thisFeed.setAttribute(&thisFeedFactory.Utility.⇒
FEEDATTRIBUTE_LOGOURL, "", "http://example.com/logo.jpg");
&succeed = &thisFeed.save();
End-If;