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

Using different buttons to "navigate" a contained mashup by changing a session parameter.

rrosenlof
4-Participant

Using different buttons to "navigate" a contained mashup by changing a session parameter.

Hello,

I've got a contained mashup that is displaying data based on a "Step_Id" that it uses as a Mashup Parameter.

I am trying to have Prev and Next buttons that will cycle through the Step_Id and change the contained mashup.

I am using:

var params = {

name: "Step" /* STRING */,

value: Step /* STRING */

};

// no return

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

As a Javascript service to update the "Step" Session Parameter. It seems that this isn't refreshing properly, something to do with client/server side stuff from what I've read. I can't figure out how to get it working. I believe I need another service that refreshes or updates the session variable.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
rrosenlof
4-Participant
(To:CRArko)

Hey,

I should have updated, I found a solution a few days ago.

I made a service for each button that returns the "Step_Id" as an ouput.

Upon service invoke for that service, it invokes a "Set Step" service, which is below. This step is not bound to anything on the mashup, it is just triggered on the button click and when the service is invoked, it triggers the last step at the bottom.

var params = {
name: "Step" /* STRING */,
value: Step /* STRING */
};

// no return
Resources["CurrentSessionInfo"].SetGlobalSessionStringValue(params);

This service triggers another step upon invoke which outputs to the session parameter I want to update. I think the key here is that I had to have a service which read the server side updated session value and then bind that to the session parameter. This would cause the on change trigger for the session parameter to occur. See second step which is manually bound below:

// result: INFOTABLE dataShape: "undefined"

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

var result = result.Step;

This allowed me to have multiple buttons update the session parameter to a different value, but still trigger the session parameter changed event.

Thanks!

(Can't upload a mashup example due to work policies)

View solution in original post

2 REPLIES 2
CRArko
17-Peridot
(To:rrosenlof)

Hello, Russ.

Could you export and attach the mashup you're creating? Also, what version of ThingWorx do you have?

Thanks!

-- Craig A.

rrosenlof
4-Participant
(To:CRArko)

Hey,

I should have updated, I found a solution a few days ago.

I made a service for each button that returns the "Step_Id" as an ouput.

Upon service invoke for that service, it invokes a "Set Step" service, which is below. This step is not bound to anything on the mashup, it is just triggered on the button click and when the service is invoked, it triggers the last step at the bottom.

var params = {
name: "Step" /* STRING */,
value: Step /* STRING */
};

// no return
Resources["CurrentSessionInfo"].SetGlobalSessionStringValue(params);

This service triggers another step upon invoke which outputs to the session parameter I want to update. I think the key here is that I had to have a service which read the server side updated session value and then bind that to the session parameter. This would cause the on change trigger for the session parameter to occur. See second step which is manually bound below:

// result: INFOTABLE dataShape: "undefined"

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

var result = result.Step;

This allowed me to have multiple buttons update the session parameter to a different value, but still trigger the session parameter changed event.

Thanks!

(Can't upload a mashup example due to work policies)

Top Tags