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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Missing entities from service

jensc
17-Peridot

Missing entities from service

Hello community.

 

I was wondering if someone here could perhaps explain to me why these two code snippets do not provide the same result of things?

 

I have two things:
VAM_KOP_68316_0

VAM_KOP_68316_1

They are both in the VAM_KOP_Project:

jensc_0-1700229708090.pngjensc_1-1700229739681.png

 

They both appear in the browse window:

jensc_2-1700230162783.png

And they also both appear in the Thing browse function:

jensc_3-1700230204185.png

I can unfortunately not provide a view in the projects entity list itself as it contains 10k+ entities.

 

  let entities = Resources["EntityServices"].GetEntityList({
    maxItems: undefined /* NUMBER {"defaultValue":500} */,
    nameMask: "VAM_KOP*" /* STRING */,
    type: "Thing" /* STRING */,
    tags: undefined /* TAGS */,
});

^ this one doesn't give me any of the two things.

Whereas this one gives both:

let projectEntities = Projects["VAM_KOP_Project"].GetEntities();

jensc_4-1700230341229.png

 

I do not understand why this is... Could it be some type of data corruption?

 

Thanks,

Jens C

ACCEPTED SOLUTION

Accepted Solutions
VladimirRosu
19-Tanzanite
(To:jensc)

If I look carefully in your snippet for GetEntityList, I see that you left out the maxItems as undefined.

If that parameter is undefined, it will take the default value of 500 when executing the service.

Internally, the GetEntityList will first retrieve all the entities then apply the name filter, but because it uses the default 500 value, when parsing through the entities it will not reach the entity you're interested in (to match the filter and give you the result you expect).

 

The GetEntities simply does not have this parameter (so it's both a bit more dangerous to use)

View solution in original post

2 REPLIES 2
VladimirRosu
19-Tanzanite
(To:jensc)

If I look carefully in your snippet for GetEntityList, I see that you left out the maxItems as undefined.

If that parameter is undefined, it will take the default value of 500 when executing the service.

Internally, the GetEntityList will first retrieve all the entities then apply the name filter, but because it uses the default 500 value, when parsing through the entities it will not reach the entity you're interested in (to match the filter and give you the result you expect).

 

The GetEntities simply does not have this parameter (so it's both a bit more dangerous to use)

Hello Vladimir,

 

Ah yes, how could i have missed that!

Setting a higher number let me see the entities.

 

Thanks,

Jens C.

Announcements


Top Tags