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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Thingworx Dashboard - Persist User Selected values

TricoSupport
7-Bedrock

Thingworx Dashboard - Persist User Selected values

My users would like the ability to pick and choose on there dashboard gauges and the equipment the data on those gauges represent.  So for a particular gadget I have a drop down list with equipment names.  The temperature of the selected widget is what get's display when the user has the gadget added to their dashboard.  When the user refreshes the screen they have to again pick from the drop down.  Is there a simple way to get the selected item to persist or do I have to build some sort of data table keeping track of selections?

ACCEPTED SOLUTION

Accepted Solutions
AdamR
14-Alexandrite
(To:TricoSupport)

If you just want to persist the selection in the current browser session you could user Global Session Value (setup in the GlobalSessionProperties ThingShape) to hold the data until the browser session is closed or expires. 


To save them per user across sessions I would setup and use User Properties.  These properties are defined in ThingShapes also and can be configured to use more than one shape in the configuration tab of the UserManagementSubsystem.

 

Keep in mind for either option these values will be loaded/updated/cached in the browser so limit how much data is kept in them.  For example 20 properties of type String will be fine.  One property of type Infotable will 1,000 rows in that table can cause problems.

View solution in original post

3 REPLIES 3
AdamR
14-Alexandrite
(To:TricoSupport)

If you just want to persist the selection in the current browser session you could user Global Session Value (setup in the GlobalSessionProperties ThingShape) to hold the data until the browser session is closed or expires. 


To save them per user across sessions I would setup and use User Properties.  These properties are defined in ThingShapes also and can be configured to use more than one shape in the configuration tab of the UserManagementSubsystem.

 

Keep in mind for either option these values will be loaded/updated/cached in the browser so limit how much data is kept in them.  For example 20 properties of type String will be fine.  One property of type Infotable will 1,000 rows in that table can cause problems.

This makes sense I'm just not sure how to access the property values by UserSession.  I created a datashape with the properties I wanted and added it to the session shapes section of UserManagement.  Now I am not sure how to read/write to those properties for the current user.  With the Global Session variables you just use the following to get the values: Resources["CurrentSessionInfo"].GetGlobalSessionValues();  How do I do this with the newly added datashape?

I figured out how to get the values and figured I would post for anyone else who might be having troubles with this:


var params = {
name: "xyz" /* STRING Variable Name*/,
value: "121346" /* STRING */
};

// no return

//Sets the value of the newly defined property
Resources["CurrentSessionInfo"].SetGlobalSessionStringValue(params);


// result: INFOTABLE

//Get all the values
var result = Resources["CurrentSessionInfo"].GetGlobalSessionValues();

Announcements


Top Tags