Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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?
Solved! Go to Solution.
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.
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();