what is the meaning of this in Mule 3 #[payload.?status == 'completed'] - mule

In mule 4 the below statement can be used to check weather element is present or not. it returns true or false
payload.key?
can some one please explain what is the meaning of using question mark in the below statement mule 3.
#[payload.?status == 'completed']
how can we achive same in mule 4

It is a "Null Safe" way of fetching values from a payload. You can refer the official document here: https://docs.mulesoft.com/mule-runtime/3.9/mel-cheat-sheet#chained-elements
In this example, if a field named address is null, the expression
throws a NullPointerException.
#[payload.address.zipcode]
To make this same expression null safe, use the .? operator.
#[payload.address.?zipcode]
Using this operator avoids a NullPointerException if address is an empty value, instead it returns
null.
In Mule 4 this is changed, and it is always null safe when extracting data. i.e. payload.address.zipcode will return null if address or payload null

Related

Condition XPath Expression in SoapUI - how to compare two values stored in custom properties?

I have successfully captured four values from a response. I need to check that none of them are the same as any other (without worrying about every combination). In theory, checking that Value1 <> Value2, Value2 <> Value3, Value3<> Value4 are all true.
I could go with a mathematical identity approach (eg where Value1/Value2*Value2/Value3*Value3/Value4 = 0). I am failing in what I actually put in the body of the Condition XPath Expression in SoapUI (and the help is woeful, as always). Pretty sure I don't need to worry about the namespace stuff.
Right now I have three separate conditions eg ${#TestCase#Value1} <> ${#TestCase#Value2} but I am getting a "no condition is true for current response" message when I know that 3 of the four are true.
Also, if the condition I am looking for is true, I need to halt, or pop to a step that does nothing. Any ideas on that?
Full current entry in the Condition XPath Condition box is:
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://transferobjects.abc.def.org.nz';
declare namespace ns2='http://abc.def.org.nz/api/serviceorder';
${#TestCase#Value1} <> ${#TestCase#Value2}
(but I am pretty sure the first three lines aren't even needed because I am not getting anything from the message response, I have captured those already into the valueX items above).

Validation Rule: NULL value

My users would like to enter a value in the NAME attribute of an entity in SQL Server Master Data Services. The valid values must contain zero to six characters. NULL is a valid value.
I have written a validation rule with a action containing a regex to ensure that the value is six or less characters (Name must contain the pattern ^.{0,6}$), but the NULL values get flagged with a "Validation Failed" status. I would like the NULL values to pass the validation test.
Is there a way to do this?
Thanks for your time. I appreciate your help.
I found the answer to my question on another site. I tested it, and it works.
Here it is:
Conditions:
If
MyAttribute contains the pattern .*
Actions:
Then
MyAttribute must contain the pattern ^.{0,6}$
Thanks
Add an "OR Name IS NULL" to the validation rule.

JMeter Random Variable Element not recognise variable from previous step

tl;dr
When I use my variable created in Regular Expression Extractor I cannot use it in Random Variable as Maximum Value
Long description:
My test structure:
I have variable my_test what is crated in Regular Expression Extractor
request: GET //echo.getpostman.com/get?test=123
regex:
Then I want it use as Maximum Value in Regular Expression Extractor
So finally I can make request:
//echo.getpostman.com/get?test=${rand}
Unfortunately I get error from Random Variable
2016/10/07 07:52:41 ERROR - jmeter.config.RandomVariableConfig: maximum(${my_test}) must be > minimum1)
Why my_test is not evaluated?
I have tried ${__javaScript(parseInt('${my_test}'))} but it looks like it is evaluated before my variable initialization
2016/10/07 08:06:01 ERROR - jmeter.config.RandomVariableConfig: maximum(NaN) must be > minimum1)
If I initialize this variable in Test Plan in User Defined Variables value from that setting will be used - not updated by regex.
I know that I can do //echo.getpostman.com/get?test=${__Random(0,${my_test})}
I'm just curious how pass my variable as value for Maximum Value in Regular Expression Extractor.
Random Variable is a Config Element and it will be executed first before any other components get executed first.
4.9 Execution order
Configuration elements
Pre-Processors
Timers
Sampler
Post-Processors (unless SampleResult is null)
Assertions (unless SampleResult is null)
Listeners (unless SampleResult is null)
If two or more Config elements present in the Test Plan, then they will be executed in the order they appear in the Test Plan.
Check the execution order and Scope here:
Refer 4.9 7 4.10 here Execution Order and Scope Rules
So, first Random Variable is evaluated first and then Sampler and then regular expression extractor.
When you used User Defined Variables, which is another Config Element, and probably you put it before Random Variable, so it evaluated the expression as you already defined the value for "my_test". But it won't override the value you captured in Regular Expression Extractor.
To solve your problem (one probable solution):
you can use different thread groups. In first thread group, you capture the value and in second thread group, you use the value.
Run Thread Groups consecutively.
Use BeanShell Assertion to capture the value by setProperty. (in first thread group)
Use value using __property() (in thread group)
https://www.blazemeter.com/blog/knit-one-pearl-two-how-use-variables-different-thread-groups
It seems that Random Variable element does not evaluate variables, maybe it worth creating an issue in JMeter Issue Tracker
As a workaround you can substitute it with __Random() function directly where required like:
${__Random(1,${my_test},)} - if you need the value right away, directly in you URL:
//echo.getpostman.com/get?test=${__Random(1,${my_test},)}
${__Random(1,${my_test},rand)} - if if you need to store the value into ${rand} variable as well
See:
Using JMeter Functions article for extended information on this and others JMeter Functions.
Function Helper Dialog - an utility helping to generate correct function syntax.
I think it's valid for me to comment on a problem I had, I set the random variable and it didn't work at all, I did everything I could to try to solve it.
In the end my problem was a space at the beginning of the variable.
One possibility is you can use a Beanshell Postprocessor to write the RegEx value to the variable name.
After that you can use it as ${variable_name}
NB: Beanshell function vars.get can be used for getting regex value and vars.put can be used for putting it into your variable.

Refer to NULL in List of Values (Oracle APEX)

So I have a List of Values, and I want to have a display value of "Yes" when the return value is NULL. I tried leaving the return value blank, and even writing null, but when I go to my table and use the LOV, instead of getting my return value "Yes", I still get
-
Is there a proper way to refer to NULL in a list of values return value? Thanks.
I know that 3.x and earlier behave differently. I'm on 4.1, but I think 4.2 is the same.
In the "List of values" section of your page item definition, ensure that:
Display Null Value is set to: Yes
Null Display Value is set to: Yes
Null Return Value is left blank
Where are you seeing the dash? In a report showing the information? If so, reports default nulls to dashes - see 'report attributes' -> 'show null values as'.
Otherwise, you may need to post what you're using for your LOV. And/or maybe an image of what you're seeing.

In how many languages is Null not equal to anything not even Null?

In how many languages is Null not equal to anything not even Null?
It's this way in SQL (as a logic language) because null means unknown/undefined.
However, in programming languages (like say, C++ or C#), a null pointer/reference is a specific value with a specific meaning -- nothing.
Two nothings are equivilent, but two unknowns are not. The confusion comes from the fact that the same name (null) is used for both concepts.
In VB6 the expression Null = Null will produce Null instead of True as you would expect.
This will cause a runtime error if you try to assign it to a Boolean, however if you use it
as the condition of "If ... Then" it will act like False. Moreover Null <> Null will also
produce Null, so:
In VB6 you could say that Null is neither equal to itself (or anything else), nor unequal!
You're supposed to test for it using the IsNull() function.
VB6 also has other special values:
Nothing for object references. Nothing = Nothing is a compile error. (you're supposed to compare it using "is")
Missing for optional parameters which haven't been given. It has no literal representation so you can't even write Missing = Missing. (the test is IsMissing(foo))
Empty for uninitialized variables. This one does test equal to itself although there's also a function IsEmpty().
... let me know if I've forgotten one
I remember being a bit disgusted with VB.
Oracle is this way.
SELECT * FROM dual WHERE NULL=null; --no rows returned
MySQL has a null-safe equality operator, <=>, which returns true if both sides are equal or both sides are null. See MySQL Docs.
In C#, Nullable<bool> has interesting properties with respect to logical operators, but the equality operator is the same as other types in that language (i.e., ((bool?)null == (bool?)null) == true).
To preserve the short-circuited behavior of the short-circuited logical operators, and to preserve consistency with the non-short-circuited logical operators, the nullable boolean has some interesting properties. For example: true || null == true. false && null == false, etc. This stands in direct contradiction with other three-valued logic languages such as ANSI SQL.
You can make ruby work that way:
class Null
def self.==(other);false;end
end
n=Null
print "Null equals nothing" if n!=Null
In SQL you would have to do something like:
WHERE column is NULL
rather than
WHERE column = NULL