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

Can I get the button that triggered a service in the script of that service?

SOLVED
nadams1
Newbie

Can I get the button that triggered a service in the script of that service?

I have a script that returns an infotable of dates (to drive a report). I want to provide three buttons to trigger different results from this script. for yesterday, last week and last 30 days.

The script works by setting the end date to yesterday and the start date to yesterday -0, -7 or -30 doys.

What I want to do is assiocate the number with each of the buttons, which when clicked will trigger the script but the value 0, 7, 30 would be avilable in the script.

I've tried setting the number in the buttons contextid but can't see a way to pass this into the script as I can only bind one button to the input parameter. I have also tried binding the button to another script which sets a session parameter (programmatically) but this requires a browser refresh to update the session parameter so it not practical.

is there anyway to get the button that triggered a service?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Can I get the button that triggered a service in the script of that service?

You can do it in different ways:

  • You can use a Radio Button which has 3 states ( one for each value )
  • You can use a DropDown list with the 3 values with three good looking names, and selected row has a value ( not shown field ) which it's the number of days, and this selected row it's the one you pass as the parameter on the service.
  • Trying to do it with Buttons will be hard, you will need too much controls to do it ( Checkboxes and Expression widgets ).

View solution in original post

2 REPLIES 2

Re: Can I get the button that triggered a service in the script of that service?

You can do it in different ways:

  • You can use a Radio Button which has 3 states ( one for each value )
  • You can use a DropDown list with the 3 values with three good looking names, and selected row has a value ( not shown field ) which it's the number of days, and this selected row it's the one you pass as the parameter on the service.
  • Trying to do it with Buttons will be hard, you will need too much controls to do it ( Checkboxes and Expression widgets ).

View solution in original post

Re: Can I get the button that triggered a service in the script of that service?

Thank you - never even thought of using radio buttons/list. I've opted for dropdown,

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.