Dialogflow CX - using sys.person gives wierd output - dialogflow-cx

https://i.stack.imgur.com/k1bZD.png
I am using sys.person to capture the person's name. Is there any way for just 'john' and not the entire {"name": "john"} to show instead? I want to avoid sys.given-name and sys.last-name since dialogflow says they are deprecated.

Do you have your entity configured as a list? If it is a list, you probably have to output the parameter like $session.params.name[0].name.
If it's not a list, $session.params.name.name would work, but in that case I suggest you change the entity name to person, as it would be more readable to see $session.params.person.name

From your screenshot, it looks like your parameter is an isList parameter.
I have checked today the behavior of static responses when referencing isList parameters and it seems that we can now display the list of values for a certain parameter without the array index in the responses using the format: $session.params.parameter-id.
In your case, it would be:
$session.params.name.
In addition, if you want to reference a specific array index in an isList parameter, you can use the format $session.params.parameter-id[i]. In your case, it would be $session.params.name[0]
or if you want to get the original value you can reference it as $session.params.name[0].original

Related

Laravel validation; human names for array fields

In Laravel form validation you can do this: file_description.* to validate each item of an array according to a set of rules. The problem is, the system automatically returns "file_description.1 is required" as an error message if the field is required and not filled in.
More on that here: https://ericlbarnes.com/2015/04/04/laravel-array-validation/
Now, I'm not a complex man, I just want the field to say "File Description 1 is required". I am aware you can set messages but a) my input arrays are dynamically generated by jquery (click to add more type scenario) so I'd have to use a loop like in the above example b) I feel like there must be a better way.
Is there a way to either extend the core validation system to simply return a humanized name for the array field as Laravel does with regular fields, or is there an option I missed in the docs that allows for this? I'd rather not get involved with doing some regex type search to fix this.

How do I call a c function on each occurrence in LoadRunner?

So there is this HUGE JSON that I am loading from a file and than I run it through lr_eval_string and save it to a parameter. This parameter is later used as a body in one of my REST calls.
I use lr_eval_string to dynamically replace different values in that JSON.
Now here is the problem, one of the values that I replace is unique and generated by a c function. This value appears numerous times in that JSON and needs to be unique each time, yet I am only able to call that c function once at the beginning of the action. The result is that all values end up being equal...
So my question is: how can I call my function each time this unique value appears? I am talking about functionality similar to "Update value on: Each occurrence" that is available on the Parameters section.
I see an option called "User Defined Function" in parameters which I guess could do what I am looking for yet I couldn't find any good tutorial on how to actually use this functionality. Is user defined action the way to go, is there any other solution?
Any help would be highly appreciated! :)

Laravel - Model binding not working when I use accessors

I want to populate my select box from the Laravel IoC Container.
App\Http\Utilities\BillingHelper.php
views/billing/create.blade.php
views/billing/edit.blade.php
Create the table:
Now, instead of the value, i want to display some flags and currency symbols.
Should i use mutators?
Problem
If i use mutators, when i open the edit page, i see always the first value selected, from the BillingHelper, instead of the choosen one.
Any help? Thanks.
I know it should be a comment, but I have no reputation.
What if, on you edit page, you replace null on Form::select with $client->language and $client->currency.
I know that you area binding the values with Form::Model. But worth a try.
When you use mutators the matching won't occur anymore. You'll have to use a matching static array according to the values you'll return. (the flags)
You can make it work if you make a mutator for saving the data also and simplify again to the ['it', 'en', 'lv'], otherwise your saved data will differ and the initial mutator won't work the second time. You can still make a one-time-only test.
This is why:
Your form binding is using $bill->language to retrieve the actual stored data, and compare it with the values in your $bill::lang static array. If no match found, than the first value will be always selected.
Can you provide the the currency and language fields definition in the migration for the bill?
Also retrive your values from your bills DB and paste them here for language and currency. They must be in the defined static sets.
Laravel has a way of skipping the accessor/mutator by using
$model->getOriginal('data_field').
The "getOriginal()" gets the model's original attribute values.

ASP.NET Web API - GET request with multiple arguments

What I'm trying to do is to have an api request like /api/calculator?1=7.00&2=9.99&3=5.50&4=45.76 etc. How my controller can grab the request data? The keys/codes of the query string are ints between 1 and 1000. In the query string they can be some of the 1000 codes, not necessarily all of them. The value part is doubles.
The one way I think would work is if I create a model object (ex StupidObject) with 1000 properties (should use properties named like p1, p2,..p1000 for codes now, as ints are not an allowed property name), decorated with ModelBinder. Then for the controller I could have something like GetCalcResult(StupidObject obj){...} But that doesn't seem like an elegant solution :)
I tried controllers like GetCalcResult([FromURI]Dictionary<int, double> dict){...} but dict is always null. Also without the [FromURI] I get an error. Also tried List<KeyValuePair<int, double>> as controller parameter with the same results.
Could anyone point me at the right direction or give me an working example?
One way is to avoid trying to pass the values in as a parameter and simply do
var queryValues = Request.RequestUri.ParseQueryString();
in your action method. QueryValues will be NameValueCollection that you can iterate over to get access to your query parameters.
If you really want to use a parameter, having a parameter of type [FromUri]FormDataCollection might work.

OData $filter substringof applied to a list of strings

I have an ASP.NET Web API Controller that exposes an IQueryable(Of String) - which is a list of descriptions. These fields can be in the order of tens of thousands, thus I use $top and $skip to only get a chunk of it - that works fine.
Now I am trying to filter these results, through the OData substringof('mydesc',Property) filter. As you can see, it requires for me to pass in a Property name on which to filter. However, since I'm returning a list of strings, I don't actually have any properties to filter on.
This causes the server to return errors like
No property or field 'tostring' exists in type 'String' - when called with $filter=substringof('asd',tostring).
If I change the call to $filter=substringof('asd',''), no errors are thrown, but no results either.
My question is, can I somehow format the $filter operator to find substrings within my list of strings, without looking for a property/field, or am I going to have to declare a class with a single property, just to enable filtering?
Things have changed since the last time I answered this. OData V3 has support for querying collection of primitives using '$it'. Asp.net Web API supports this syntax as well. For example, in your controller you can return IQueryable<string> and send a request like
$filter=substring('mydesc', $it) or
$filter=length($it) ge 5
etc. You can also expose collections of other primitives like IQueryable etc.
unfortunately declaring a class with a single property seems to be the only solution that I can think of. OData $filter doesn't have any support for something like the this parameter in C#
another less obvious approach is to expose a computed concatenated value representing the list, substringof could then be used to query the list as a single property value

Resources