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

Limit Things displayed based on user login when using GetImplementingThingsWithData

SOLVED
Highlighted
Granite

Limit Things displayed based on user login when using GetImplementingThingsWithData

Greetings to All,

 

I'm trying to create a mashup where, using a collection, I can mini mashups of multiple things using the same template.  I was able to do this with the GetImplementingThingsWithData service for that template. 

 

My issue is to limit what is displayed based on the user login.  And I don't just mean making it not visible, thereby creating blank spaces.  I know I can do this by creating templates and mashups for different users, but I figure there has to be a simpler way to do this without the extra work.

 

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Limit Things displayed based on user login when using GetImplementingThingsWithData

Could you try creating a custom service that checks the logic for current session/user info? 

2 REPLIES 2

Re: Limit Things displayed based on user login when using GetImplementingThingsWithData

Could you try creating a custom service that checks the logic for current session/user info? 

Re: Limit Things displayed based on user login when using GetImplementingThingsWithData

Yes.  That did it.  Thank you posipova.  I am stilling learning to make use of the API calls and services that ThingWorx provides.

 

I created a service to make an InfoTable using GetImplementingThingsWithData.  I then browse each row of the InfoTable to determine if the UserID value of each row matches the User Logged on.  If it does not match, I delete the row.  Below is a copy of my code if anyone is interested.

 

var things = ThingTemplates["Device_Template"].GetImplementingThingsWithData();
var qty = things.getLength();

for (var x=0; x < qty; x++) {
     var row = things.getRow(x);
     if (row.getValue("UserID") != ID) {
          things.RemoveRow(x);
          qty = things.getLength();
          x = x - 1;
     }
}

var result = things;