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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

model tag entities

AP_9587236
17-Peridot

model tag entities

Where we can see the list of entities which are under a single model tag?

1 ACCEPTED SOLUTION

Accepted Solutions

Using the above service code mentioned by me, you can extract all the entities which are tagged with your tag. Once you get all those entities you have to loop through them and on the basis of parentType/parentName you can remove the tag on a particular entity name. For example, if you have parentType/parentName in the row as mashup then using the name column you can remove the tag. //below is just a sample code to explain how you can do it, I just wrote it but did not test the loop.

 

let params = {
maxItems: undefined /* NUMBER */,
searchExpression: undefined /* STRING */,
types: undefined /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: "ABC:Test" /* TAGS */
};

// result: INFOTABLE dataShape: EntityDescriptor
let table = Resources["SearchFunctions"].SearchModelEntities(params);

for(var a=0;a<table.length;a++)

{

If(table[a].parentType/parentName="Mashup")

Mashups[table[a].name].RemoveTags({
tags: "ABC:Test" /* TAGS */
});

else if (table[a].parentType/parentName="Thing")

{

Things[table[a].name].RemoveTags({
tags: "ABC:Test" /* TAGS */
});

//for all the different parentType/Name

}

}

View solution in original post

4 REPLIES 4

Can you try this snippet, pass you model tag:

let params = {
maxItems: undefined /* NUMBER */,
searchExpression: undefined /* STRING */,
types: undefined /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: "ABC:Test" /* TAGS */
};

// result: INFOTABLE dataShape: EntityDescriptor
let result = Resources["SearchFunctions"].SearchModelEntities(params);

Thanks @mnarang .

1. I have 100 entities under single modeltag. If i want to remove all of them means, should i edit each entity to remove model tag??

2. If n number of tags provided to single entity means, it will consume any amount of memory? 

3. I tried this code and this is not working. then what is the right way to use these services.?

 

try {

Mashups["TrialMashup3"].Resources["SearchFunctions"].RemoveTags("Role:Abhishek");

} catch(err) {

logger.warn(err+"in linenumber "+err.lineNumber);

}

 

Using the above service code mentioned by me, you can extract all the entities which are tagged with your tag. Once you get all those entities you have to loop through them and on the basis of parentType/parentName you can remove the tag on a particular entity name. For example, if you have parentType/parentName in the row as mashup then using the name column you can remove the tag. //below is just a sample code to explain how you can do it, I just wrote it but did not test the loop.

 

let params = {
maxItems: undefined /* NUMBER */,
searchExpression: undefined /* STRING */,
types: undefined /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: "ABC:Test" /* TAGS */
};

// result: INFOTABLE dataShape: EntityDescriptor
let table = Resources["SearchFunctions"].SearchModelEntities(params);

for(var a=0;a<table.length;a++)

{

If(table[a].parentType/parentName="Mashup")

Mashups[table[a].name].RemoveTags({
tags: "ABC:Test" /* TAGS */
});

else if (table[a].parentType/parentName="Thing")

{

Things[table[a].name].RemoveTags({
tags: "ABC:Test" /* TAGS */
});

//for all the different parentType/Name

}

}

does providing multiple tags to single entity consumes memory?? 

Top Tags