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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Limit Things displayed based on user login when using GetImplementingThingsWithData

Timo697
13-Aquamarine

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.

ACCEPTED SOLUTION

Accepted Solutions
posipova
20-Turquoise
(To:Timo697)

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

View solution in original post

2 REPLIES 2
posipova
20-Turquoise
(To:Timo697)

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

Timo697
13-Aquamarine
(To:posipova)

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;

 

 

Announcements


Top Tags