- Goal: I have a web service that can take either of two arguments: serial number and customer name.
You can have one of these arguments but not both.
- Steps:
I created a dropdown called searchType.
I created a submit button called searchBtn
I created a resource called itemSearchApi
I know how to get the submit button to read the value from this dropdown.
The resource calls the API, but while the values passed through the query string are dynamic and based on what is inside a text box, the parameter names are not.
I can't figure out how to change the parameters. I want to do this:
- Select either serial number or customer name
- Enter a search term.
- If serial number is selected, send one particular query string to the resource.
- If customer name is selected, send a different query string to the resource.
e.g send **http://redactedstuff/?serial=WHATEVER or http://redactedstuff/?name=SOMETHING depending on the value of the select message/
I tried creating two different resources, but then I have trouble displaying the results into the application. Besides of which, creating a lot of Retool resources that connect to the same endpoint seems like it could get hard to maintain
I have heard that this can be accomplished by telling the searchBtn listener to run Javascript and then use the .trigger() function (itemSearchApi.trigger() ) but I cannot find any instructions on how to send arguments to the resource through this.