cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Set Tag for Media Entities from a Service in for loop

DM_9985019
6-Contributor

Set Tag for Media Entities from a Service in for loop

I have a list of entities prepared in an infotable. Looks like "Things[entityname].SetTags(params);" this code works only for things but not for media and style definition entities. Please help.

 

 

try
{

var selectedTags = INFOTABLE; \\(list of entities);

var tableLength = selectedTags.rows.length;
for (var x = 0; x < tableLength; x++) {
var row = selectedTags.rows[x];

var tags = new Array();
var params = {
tags: "TagName:Voc"
};

var entityname = row.name;
Things[entityname].SetTags(params);

}
}
catch(err) {
logger.error("Error @ Thing -"+me.name+", Myservice, @ line " + err.lineNumber + ": " + err);
}

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @DM_9985019 ,

I personally haven't tried this, but for Media entity and Style Definition, can you please below two:

MediaEntities[entityname].SetTags(params);
and
StyleDefinitions[entityname].SetTags(params);

 

Thanks,

Shirish

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:DM_9985019)

Media entities most likely (I haven't tried) do not support services, so to get tags on a Media entity, you probably need to rewrite the full definition.

I don't recall there to be a specific service to just add tags to a Media entity.

Hello @DM_9985019 ,

I personally haven't tried this, but for Media entity and Style Definition, can you please below two:

MediaEntities[entityname].SetTags(params);
and
StyleDefinitions[entityname].SetTags(params);

 

Thanks,

Shirish

Hi @DM_9985019.

 

If either of the previous responses allowed you to find a solution, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags