Can We Count The Number Of Query Parameters Passed Through Browser In Mule
I am trying to write a stored procedure which works dynamically. For example, If I pass three query parameters from the browser to the flow it should be assigned to the stored procedure and it should retrieve only the values from the database only for which the passed values. (Note: I am using select query in my stored procedure). I should be able to pass n number of query parameters. Could anyone assist me on this.
Answer
For your query on how to get the Query parameters key names:
Use the below expression to get the first query parameter key name. Change index value based on query parameter number.
#[message.inboundProperties.'http.query.params'.keySet().toArray()[0]]
See the below sample code that iterates over the query parameters and stores each query parameter key name into variable then prints it in logger.
<foreach collection="#[message.inboundProperties.'http.query.params'.keySet()]" doc:name="For Each">
<set-variable variableName="QueryPramKey" value="#[payload]" doc:name="Variable"/>
<logger message="--- Query param kay names: #[flowVars.QueryPramKey]" level="INFO" doc:name="Logger"/>
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → I can't do a foreign key, constraint error
- → Setting a default value on settings form return null in Octobercms
- → Eloquent Multitable query
- → "Laravel 5.1" add user and project with userId
- → Image does not go in database with file name only tmp name saved?
- → Database backup with custom code in laravel 5 and get the data upto 10 rows from per table in database
- → Trait 'IlluminateFoundationBusDispatchesJobs' not found
- → Setting the maxlength of text in an element that is displayed
- → laravel check between 2 integer from database
- → how to retrieve image from database in laravel 5.1?
- → relationship for database Column type object
- → Carousel in Laravel 4 does not show as expected