OR condition not working in Dialogflow CX - dialogflow-cx

I have an intent that contains several parameters. I established a route that should be activated when the first parameter OR the second one is not empty:
$intent.params.tipo3.resolved : "" OR $intent.params.valutarapporti.resolved : ""
If either one of the parameter is not empty, then the agent should transit to another page.
The problem is that is only works when the first parameter is not empty; if the first one is empty but the second one is not, the transition does not happen. It seems like the condition "OR" is misfunctioning.
Note that the parameter is correctly recognized: the user says something that matches the correct intent, the parameter "valutarapporti" is recognized but then no transition happens.
If I separate the two conditions in two different routes, obviously it works, but I'd like to have a single route for such a simple thing. I tried setting them as session parameters, but the results does not change (and that's not really the issue: like I said, the parameter is recognized, the problem is with the transition).

To define a condition when only one intent parameter is set, but not both, you can use the following:
$intent.params.tipo3.resolved = null OR $intent.params.valutarapporti.resolved = null
In this case, you may need to define a separate condition for a situation when both parameters are set.
To define a condition when either one of the two intent parameters is set or both parameters are set, you can use the following:
$intent.params.tipo3.resolved != null OR $intent.params.valutarapporti.resolved != null

The answer posted by Svetlana solved my problem; I'll add that I also tried to define the condition as
$intent.params.tipo3.resolved != "" OR
$intent.params.valutarapporti.resolved != ""
and that solved my immediate problem. However, it meant that the route with this condition was always valid and the other routes were never even evaluated.

Related

elasticsearch pipeline doesn't match paths

i'm trying to catch the paths that contains a specified path like
path/to/my/url/variablePart,
in the pipeline condition i put
ctx.url.path == 'path/to/my/url/' but unfortunately it takes only the logs that have path/to/my/url/ without considering the other ones with a variable part,
there is a wildcard that can help me to catch every path that start with 'path/to/my/url/'??
I have already tried to do ctx.url.path == 'path/to/my/url/*' but without effect.
thanks for the help!
You have two options:
A. use a regular expression match:
"if": "ctx.url.path =~ /^path\\\/to\\\/my\\\/url\\\//",
B. use the String.indexOf() function
"if": "ctx.url.path.indexOf('path\/to\/my\/url\/') == 0",
this is a peculiar situation, the path must be something like this, but instead set 'ctx.url.path == 'path/to/my/url/*' i would suggest you to use the percentage % in order to be:
'ctx.url.path == 'path/to/my/url/%' this should select all the sub paths in the directory.
If it still gets errors or doesn't respond you correctly, let me know..

Uipath string null

Does anyone know how to check for an unassigned string in uipath? Uipath seems to crash when an if statement looks for a null string. Not sure how to handle that. String.empty doesn't seem to work, and if the string is unassigned uipath stops logging and nothing happens.
There are many different approaches and ideas, but – according to me – what you can do is:
Always make sure before to define any variable by default, initialize it with empty strings(""). So it will be easy to check it with equal operator as well.
The Other approaches you can take in Uipath is based on .Net So u can use it's Is Nothing.
You can also use .Net String.IsNullOrEmpty Method (String) Method.
To check if a string variable is Null, you need to use either an If or Decision activity. The condition of those should be:
a is Nothing
This will return true if variable a is null and false otherwise
Best way to check string has value or not -->
These are some of the ways it can be checked.
1.
String.IsNullOrEmpty(yourString)
2.
yourString.Equals("")
3.
yourString.Equals(Nothing)
4.
yourString is Nothing
5.
String.IsNullOrWhiteSpace(yourString)
There are logical OR, AND and NOT to combine the different checks and they can clubbed together to check the best way to find out blank, null and whitespace string.
You can compare the string using:
Convert.ToString(DBNULL.Value)
We can check whether String is null with the following Syntax
String.IsNullOrWhiteSpace("Name_of_the_variable")
It will return boolean value
My suggestion is using the following method in UiPath
An If/Decision activity with the condition string.IsNullOrEmpty() making use of the IsNullOrEmpty() method
The best and easiest way will be the following:
String.IsNullOrWhiteSpace(stringVariableName)

Laravel Error on Repopulating: htmlentities() expects parameter 1 to be string, array given in

I noticed that whenever I am redirecting back to the input form on error using withInput(), there is a very common error that will arise some times. ie
htmlentities() expects parameter 1 to be string, array given (View:[path])
I had realised that this only(usually) occurs whenever i redirect using withInput() but if i dont use it, the error does not occur, and neither are the firlds repopulated. I had however not known why this occurs until I thought avout it yesterday, and this is my view of it.
One of the input fields in my form was a text box array, hence it had the same name like provinces[] in all the fields. Remember that Laravel's Input facade will get it as a variable and on redirecting, it will 'come back' with this variable (which in essence is an array) and load it with the first fields called like the array(provinces). When repopulating, Laravel will (i think) pass the original field value to the e() helper function (htmlentities() in reality), which expects parameter 1 as string but the array is given.
How i solved it: i renamed the fields so that i do not use an array for their names, so that all the fields have a distinct name. That worked for me.
In case my reasoning is flawed, you may correct me with love (and respect for Taylor) ;-)
(Well, as alexrussel had said in htmlentities() expects parameter 1 to be string, array given , this can also occur when in the Form::input() only three parameters are given instead of four.)
I have the same problem but when i searches on this error i found that Laravel Input fields expects parameter 2 to be the value, and parameter 3 to be the array of attributes. So when you pass the attributes where the value should be, htmlspecialchars will flip out. or otherwise just remove the withInput option from the redirecting from controllers method it will work

JMeter "if controller" with parameters?

I was reading the JMeter documentation and came across this info box about "If Controllers":
No variables are made available to the script when the condition is interpreted as Javascript. If you need access to such variables, then select "Interpret Condition as Variable Expression?" and use a __javaScript() function call. You can then use the objects "vars", "log", "ctx" etc. in the script.
I don't quite follow this. Does this mean if I want access to a "User Defined Parameter" then I can access it only by writing some JavaScript? The example that follows this box then refers to "${COUNT}"
Could someone clarify the usage of the If Controller, maybe with an example or two?
All these answers are wrong! You need to put the variable reference in quotes, like so:
"${my_variable}"=="foo"
You can simply use something like
${my_variable}=='1'
Sometimes JMeter documentation can be confusing :)
Edit 27 september 2017:
The answer here works but has a very bad performance impact when number of threads exceeds 40.
See below for correct and most performing answer:
https://stackoverflow.com/a/46976447/460802
See:
https://bz.apache.org/bugzilla/show_bug.cgi?id=61675
UNCHECK the CHECKBOX
"Interpret condition as variable expression"
I wasted a couple of hours without unchecking this checkbox. It worked with and without semicolon(;) at the end of the statement. Make sure that you have set the User-Defined Variables before calling the if controller.
All the following variations worked for me in Jakarta Jmeter 1.5
${__javaScript("${HOMEPAGE}"=="Y")}
${__javaScript("${HOMEPAGE}"=="Y")};
"${HOMEPAGE}"=="Y"
"${HOMEPAGE}"=="Y";
If Controller will internally use javascript to evaluate the condition but this can have a performance penalty.
A better option (default one starting from JMeter 4, see https://bz.apache.org/bugzilla/show_bug.cgi?id=61675) is to check "Interpret Condition as Variable Expression?", then in the condition field you have 2 options:
Option 1 : Use a variable that contains true or false. For example If you want to test if last sample was successful, you can use
${JMeterThread.last_sample_ok}
or any variable you want that contains true/false
${myVar}
Option 2 : Use a function (${__jexl3()} is advised) to evaluate an expression that must return true or false.
For example if COUNT is equal to 1:
${__jexl3("${COUNT}"== "1",)}
OR
${__jexl3(${COUNT}== 1,)}
Starting with 4.0, if you don't use the "Interpret Condition as Variable Expression?", a warning in RED will be displayed:
If you'd like to learn more about JMeter and performance testing this book can help you.
God bless the http://habrahabr.ru
Have tried until found these.
Using the quotes was my solution.
As Gerrie said you need to check your variable
${my_var} == 'value'
But be careful with the 'User Defined Variables'
Note that all the UDV elements in a
test plan - no matter where they are -
are processed at the start.
That basically means that you cannot define 'User Defined Variables' inside an 'If Controller'. Take a look to the 'BeanShell' instead.
Replace:
${my_variable}=='1'
with
"${my_variable}" == "1"
if it's string value pass as below and its performance effective
${__groovy("${key}"=="value")}
I have used ${code_g1}== 200 in condition and it worked for me.

drupal multiple view arguments with PHP code validation for empty arguments

I have a view set up to accept 2 arguments. The url is like this: playlists/video5/%/%/rss.xml
It works fine if I supply the url with 2 arguments like playlists/video5/front/coach/rss.xml.
I have 2 arguments of "Taxonomy: Term"
But I need it to run even if 1 or no arguments are supplied. It looks like you can do this with PHP Code under: Provide default argument options -> Default argument type: -> PHP Code.
I'm using this for the first one:
$arg[0] == 'all';
return 'all';
I'm using this for the second one:
$arg[1] == 'all';
return 'all';
It's working fine in the preview if I enter 1, 2 or no arguments, but in the browser it giving me a "Page not found" error if I use less than 2 arguments in the url.
It woks with these urls:
/playlists/video5/gridiron/all/rss.xml
/playlists/video5/gridiron/football/rss.xml
It does not work with this:
playlists/video5/gridiron/rss.xml
I want it to return all values when no arguments are given, or if only one arg is given, just use the one, etc...
thanks
I would rearrange your URL to look like this: playlists/video5/rss/%/% so that way your arguments always come last. Then in your argument settings set:
Action to take if argument is not present: Display all values
This way when you go to playlists/video5/rss you will get every value. When you go to /playlists/video5/rss/term1 you will get all values that have term1 in them. Then the trick for the second argument is to include the wildcard for first argument like this: /playlists/video5/rss/all/term2. I believe that will include just the values that have the second term.
Alternatively, if these are both taxonomy terms, you may want to consolidate these into a single argument and check the box that says: Allow multiple terms per argument. According to the documentation right below the checkbox, it looks like this should allow you something like playlists/video5/rss/term1+term2 and display all values that have the first or second term.
Views will only collapse the %, not the slashes surrounding it. So while you're trying to use playlists/video5/rss.xml, Views is expecting playlists/video5///rss.xml.
To get what you're looking for, you need to duplicate the View display you're using twice.
For the first duplicate, use playlists/video5/%/rss.xml as the path. In your arguments for this view display, make sure the first argument validates for either gridiron or football.
For the second duplicate, use playlists/video5/rss.xml. There will be no arguments for this view display. If you just want all of the records to show up, you shouldn't have to do anything more. But if you want to supply a default argument other than all the records, you'd override the view display and create a filter instead of an argument.
Another (less ideal) option is to treat gridiron/football as one argument and validate it that way.

Resources