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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

using ImportSourceControlledEntities to import a single entity

cbaurand
12-Amethyst

using ImportSourceControlledEntities to import a single entity

Hi,
How can i use the ImportSourceControlledEntities  service to import a single entity: I guess i need to use the entityFilter parameter, but i'm not able to find the correct syntax:

   let entityFilter = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
        infoTableName: "InfoTable",
        dataShapeName: "EntityDifference"
    });

    entityFilter.AddRow({name: "myTemplateToImport", entityType:"ThingTemplate"});
    Resources["SourceControlFunctions"].ImportSourceControlledEntities({
         entityFilter: entityFilter,
         repositoryName: "SystemRepository",
         path: "src/twx-source"
    });
 
Any help or example would be appreciate.
7 REPLIES 7
wcui
16-Pearl
(To:cbaurand)

hi cbaurand

 

entityFilter is not necessary parameter. please refer to below sample code which I ran successfully on TW9.3.2 instance.

 

let params = {
entityFilter: undefined /* INFOTABLE {"dataShape":"EntityDifference"} */,
path: "/Things" /* STRING */,
useDefaultDataProvider: undefined /* BOOLEAN {"defaultValue":true} */,
withSubsystems: undefined /* BOOLEAN {"defaultValue":false} */,
overwritePropertyValues: undefined /* BOOLEAN {"defaultValue":true} */,
repositoryName: "RepThing" /* THINGNAME */
};

// no return
Resources["SourceControlFunctions"].ImportSourceControlledEntities(params);

 

cbaurand
12-Amethyst
(To:wcui)

My intention was to import a single entity. Your response is irrelevant.

wcui
16-Pearl
(To:cbaurand)

I attached a picture where I ran ImportSourceControlledEntities from composer. I defined entityFilter to only import thing with name "test2".

For your use case, you can define InfoTable with data shaple "EntityDifference", add a row to with entityType as "Thing" and name as target thing name.

wcui_1-1659604704421.png

 

I am also not sure about the syntax of the entityFilter, specifically the entityType, but I found in our support portal a case that suggests this works, even if you see in the log that they are processed.

If I would need a workaround now, I personally would move the entity I need to a temp folder, then process that folder via this service (without using entityFilter), then delete the folder at the end of the process.

 

Note: of course, if the case I shared does not apply, you should open a Technical Support case to get this function documented in a Support Article.

Actually, this case was found by Charlotte (ptc) and me a few weeks ago. Ii works, but the traces suggest that the filter doesn't work.
Thanks for your reply.

wcui
16-Pearl
(To:cbaurand)

yes, below article also mentions that. Info Application log is output for every entity even with filtering.

https://www.ptc.com/en/support/article/cs370821

are we good to close this?

 

 

cbaurand
12-Amethyst
(To:wcui)

yes

Announcements


Top Tags