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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

A help with session parameters

fmanniti
10-Marble

A help with session parameters

I don't really understand how it works the session parameters.
Here's my problem:
I have a mastar which has, on the header, two label
1) History (background: grey)
2) Runtime (background: blue)
When History is shown, Runtime is invisible and vice versa.

I managed this by a helper thing called ViewMode which has
two parameters: history and runtime (both booleans);
a service: which toggle the value of history;
a subscription: when history changes, runtime changes too and is the opposite of history.

Obviously this works for only one user, but if I have several users I want that each one sees what they want so I make a thingShape called ViewModeShape with 2 properties (History and Runtime) and I implemented my ViewMode thing with that Shape; than, the service and subscription are still the same.
But if I set History = True with my UserA, it will turn true also to my UserB.

Is there anything wrong in this process?

Shared with Jive Anywhere

https://community.thingworx.com/community/developers
4 REPLIES 4

I forgot to mention: the ViewModeShape is in UserManagementSubsistem

wposner-2
14-Alexandrite
(To:fmanniti)

You need to ensure your service is accessing the session instance of your parameter with a line of code such as:

var data=Resources["CurrentSessionInfo"].GetGlobalSessionValues().protocolConnections;



where "protocolConnections" is the name of my session variable.  You also need to set your session variable accorindgly:

var params = {

  name: "protocolConnections" /* STRING */,

  value: protocolConnections /* INFOTABLE */

};

Resources["CurrentSessionInfo"].SetGlobalSessionInfoTableValue(params);



​You're service should be returning the values that are stored in your session variable.  This is one case where simply binding to the session variable in the mashup build won't work.  It needs to be returned as the result of a service.

Sorry, just because I don't know if I got it right.

the protocolConnections is my session variable; it means that is my property I called History, am I right?

And what is the value in the parameters is supposed to be a Infotable?

wposner-2
14-Alexandrite
(To:fmanniti)

Right..so on your TS, you created a property called History.  You've added that property as a session parameter in the UserManagement Subsystem.  You would substitute "protocolConnections" for "history".  In my case, "protocolConnections" is an infotable property that I've defined.  You don't have to use an infotable, though.  You can use a string, or any other type. When you're creating your service, click on the "Entities" tab and type in CurrentSessionInfo for the entity name.  Then scroll down for the "Set" services. You will see all the services for all the different property types.

Announcements


Top Tags