Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
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:
They both appear in the browse window:
And they also both appear in the Thing browse function:
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();
I do not understand why this is... Could it be some type of data corruption?
Thanks,
Jens C
Solved! Go to Solution.
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)
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.