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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Get all the projects from TWX platform excluding PTC's project

PP_10477715
6-Contributor

Get all the projects from TWX platform excluding PTC's project

Hi ,

I want to get all the projects from a TWX platform excluding PTC's project.

 

3 REPLIES 3

Hi @PP_10477715 ,

 

If you are expecting to retrieve project list in TWX JS code. Kinldy find the attached code FYR. If not please explain more about your query.

/////******////// To get all project details in TWX code /////******//////
let params = {
	maxItems: undefined /* NUMBER {"defaultValue":500} */ ,
	nameMask: undefined /* STRING */ ,
	type: 'Project' /* STRING */ ,
	tags: undefined /* TAGS */
};

// result: INFOTABLE dataShape: RootEntityList
let projectList = Resources["EntityServices"].GetEntityList(params);
/////******////// Remove the project name - PTCDefaultProject from all project list /////******//////
let params1 = {
	fieldName: 'name' /* STRING */ ,
	t: projectList /* INFOTABLE */ ,
	value: 'PTCDefaultProject' /* STRING */
};
// result: INFOTABLE
let result = Resources["InfoTableFunctions"].NEFilter(params1);

Thanks & Regards,

Arun C

PP_10477715
6-Contributor
(To:Arun_C)

Hello,

 

As i can see in above service first we are fetching all the projects and then we are using filter on that,

So unnecessarily we are loading all the rows, also i have multiple ptc's app deployed on platform and i have to exclude those.

May be we can use the tags, but i don't know how to exclude multiple tags.

 

one another service is SpotLightSearch, that may be we can use , where we can pass the not expression (the project name not starts with PTC) but i am not sure how we can use that expression.

 

var params = {
maxItems: 100 /* NUMBER */,
searchExpression: " <not expression>"/* STRING */, for eg. "My_proj*" (it will fetch all the project name starts with My_Proj
types: {"items" : ["Project"]} /* JSON */,
  withPermissions: true /* BOOLEAN */,
endDate: undefined /* DATETIME */,
aspects: {"isSystemObject":false} /* JSON */,
excludedAspects: undefined /* JSON */,
tags: [] /* TAGS */,
thingTemplates:  {}  /* JSON */,
searchDescriptions: true /* BOOLEAN */,
thingShapes: {} /* JSON */,
sortBy: undefined /* STRING */,
isAscending: undefined /* BOOLEAN */,
projectName: "" /* PROJECTNAME */,
maxSearchItems: undefined /* NUMBER */,
startDate: undefined /* DATETIME */
};
 
// result: INFOTABLE dataShape: SpotlightSearch
var result = Resources["SearchFunctions"].SpotlightSearch(params);
Rocko
17-Peridot
(To:PP_10477715)


So unnecessarily we are loading all the rows, also i have multiple ptc's app deployed on platform and i have to


Don't overengineer this. How many projects are on your systems? Even it's 100, if loading those is an issue, you're in trouble.

You can use this to name-filter projects starting with PTC:

 

let params = { nameMask: "(?!PTC).*", type: 'Project' };
result = Resources["EntityServices"].GetEntityListByRegEx(params);

 

But this is not guaranteed to filter out all projects coming from PTC. Especially older extensions (e.g. Analytics) might not comply with the naming scheme or use tags.

 

Top Tags