Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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.
Solved! Go to Solution.
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)
Hello, Russ.
Could you export and attach the mashup you're creating? Also, what version of ThingWorx do you have?
Thanks!
-- Craig A.
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)