How to read query string in ExtJS 4? - extjs4

I have an ExtJS application which is invoked with some query string parameters. I would like to know how to read those parameters and their values using ExtJS 4.
My ExtJS application URL will look like the following:
http://localhost:8080/myapp?candidate_id=101&candidate_id=102&candidate_id=103

You can use Ext.Object.fromQueryString like this
Ext.Object.fromQueryString('candidate_id=101&candidate_id=102&candidate_id=103')
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Object-method-fromQueryString

Related

Dot.NET Core Routing and Controller Processing discrepancy

I am trying to use the asp-route- to build a query string that I am using to query the database.
I am confused on how the asp-route- works because I do not know how to specifically use the route that I created in my cshtml page. For example:
If I use the old school href parameter approach, I can then, inside my controller, use the specified Query to get the parameter and query my database, like this:
If I use this href:
#ulsin.custName
then, in the controller, I can use this:
HttpContext.Request.Query["ID"]
The above approach works and I am able to work with the parameter. However, if I use the htmlHelper approach, such as:
<a asp-controller="Report" asp-action="Client" asp-route-id="#ulsin.ID">#ulsin.custName</a>
How do I get that ID from the Controller? The href approach does not seem to work in this case.
According to the Anchor Tag Helper documentation, if the requested route parameter (id in your case) is not found in the route, it is added as a query parameter. Therefore, the following final link will be generated: /Report/Client?id=something. Notice that the query parameter is lowercase.
When you now try to access it in the controller as HttpContext.Request.Query["ID"], since HttpContext.Request.Query is a collection, indexing it would be case-sensitive, and so "ID" will not get you the query parameter "id". Instead of trying to resolve this manually, you can use a feature of the framework known as model binding, which will allow you to automatically and case-insensitively get the value of a query parameter.
Here is an example controller action that uses model binding to get the value of the query parameter id:
// When you add the id parameter, the framework's model binding feature will automatically populate it with the value of the query parameter 'id'.
// You can then use this parameter inside the method.
public IActionResult Client(int id)

Can we append URL parameters to an endpoint based on values in a test case?

Is it possible to send input parameters to the chatbot from test cases, both with and without user input? What I have in mind is that I should be able to do this in the test cases:
Test case 1
#me
Hello
INPUT_PARAMETER sttConfidence : 0.58
INPUT_PARAMETER callerCountry : GB
#bot
Hi human! I see that you sent some input parameters. Thank you!
...
...
The input parameters need to be appended to the endpoint, so the URL would look like this:
https://MyChatBotsEndpoint.com/?userinput={{msg.messageText}}&sttConfidence=0.58& callerCountry=GB
The values that we send need to be of type string.
Is this possible to achieve in Botium? And if yes, are there any native tools in Botium that can achieve this, or do we need to develop our own function?
Edit:
This is what happens when I added the piece of code:
Example of how input parameter merges with input message
Ideally I would like it to look like this:
This is what it looks like if I manually send &countryCaller=GB to our endpoint
There is nothing like that included, but with the right combination of a logic hook and the HTTP/JSON request hook it is possible.
The UPDATE_CUSTOM logic hook will copy the parameters from the convo file to the internal Botium message object:
Test case 1
#me
Hello
UPDATE_CUSTOM QUERY_PARAM|sttConfidence|0.58
UPDATE_CUSTOM QUERY_PARAM|callerCountry|GB
#bot
Hi human! I see that you sent some input parameters. Thank you!
...
The SIMPLEREST_REQUEST_HOOK capability will then use the parameters to adapt the request url accordingly with a little Javascript code:
...
"SIMPLEREST_REQUEST_HOOK": "if (msg.QUERY_PARAM) requestOptions.uri = requestOptions.uri + '&' + Object.keys(msg.QUERY_PARAM).map(key => key + '=' + msg.QUERY_PARAM[key]).join('&')",
...
Alternative Approach
If you don't like the SIMPLEREST_REQUEST_HOOK Javascript code, you could also use Mustache templates to add the query parameters to the URL:
...
"SIMPLEREST_URL": "https://MyChatBotsEndpoint.com/?userinput={{msg.messageText}}&sttConfidence={{msg.QUERY_PARAM.sttConfidence}}&callerCountry={{msg.QUERY_PARAM.callerCountry}}"
...
(you will have empty parameters, but you can tune this mustache template as you want to exclude empty parameters).

Parameters CrossBand Like XRCrossBandBox

I have a parameter Like the pictures Below :
How to Pull The XRLabel(Parameters) From GroupHeader1 to GroupFooter1 Like XRCrossbandBox did ?
unfortunately there is no such built in functionality

How to pass mulitple querystring value in MVC 4

I want to pass 7 querystring value from one ctroller to another controller action.
In my old applicaiton, I was passing these value into query string in URL.
Now, in MVC 4, please suggest me how i could include in "RedirecttoAction" or any other way ?
you can simply pass parameters of action like this:
return RedirectToAction("Action","Controller", new {id=1,name="test",......})

In Yii, is there a way to have urlFormat => path but still pass query params with an ampersand?

Currently (in Yii 1.1.13) all createUrl methods put extra params in the 'path style', which means I cannot then override them by submitting a form, because they take precedence over those that come in a query string. Is there a way to always pass extra parameters in query string but still have the url look normal and not butt-ugly like with the get urlFormat?
You can set appendParams to false in your urlManager component configuration.