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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Limit Things displayed based on user login when using GetImplementingThingsWithData

Timo697
12-Amethyst

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
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
12-Amethyst
(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;

 

 

Top Tags