Lack of null inequality support in Firestore's PHP SDK - google-cloud-firestore

We are able to run null inequality just fine on the JavaScript SDK (client or admin), but we are unable to in PHP? To me it seems this is a backend feature which is already supported by Firestore, but throws an error in PHP.
->where('preorders', '!=', null)
Uncaught InvalidArgumentException: Null and NaN are allowed only with operator EQUALS.
Whereas the equivalent in JS SDK works just fine.
query(q, where('preorders', '!=', null))
Since I cannot open an issue in google's PHP SDK repo here, is there any way we can find a reason as to why this is not possible?

The documentation says, :
“A field exists when it's set to any value, including an empty string (" "), null, and NaN (not a number). Note that null field values do not match != clauses, because x != null evaluates to undefined.”
Explanation : Yes, even if we add an empty string, null,( supported data type in Firestore) or NaN, it doesn't mean that the field doesn't exist. It definitely exists and holds one of those values. And coming to when we compare x != null in where clauses, x != null evaluates undefined, but for non-exist fields. And undefined is not a supported data type in Firestore, according to this Firestore supported data type.
So we can compare .where(x!=null) and it is supported, but it evaluates to undefined for non-existent fields.
As mentioned in similar thread, the version release of v7.21.0 in Firestore JS SDK supports the != operator with where clause from version 7.21.0
But while digging deeper in the documentation, I found that php5 supports != operator as you can see in the code snippet, but the php8 does not support != operator yet and the workaround is using not-in instead of it as shown in this code snippet.
Maybe you are trying to use php version >5 and hence the error.
There is already an open issue on this, in GitHub. You may follow the link for updates and changes or you can create a new request here.

Related

Filtering column strings that contain substring

I am working on an if else in the Tmap, and one of the conditions is if a column contains a substring.
I am unsure exactly how to go about this being fairly new to talend.
This is the current syntax that I am using.
row16.Location.contains("clos")?"Pending":""
I have not been able to find any good examples of the correct way to go about this, other than the one above.
Talend uses Java as an underlying language, so you need to use the ternary operator of Java:
row16.Location.contains("clos") ? "Pending" : ""
But make sure you first check row16.Location for null, otherwise you'll get a NullPointerException if Location is null :
row16.Location != null && row16.Location.contains("clos") ? "Pending" : ""

Drools rule to check for empty conditions in Collection for versions above 5.4.0

Previously in Drools 5.1.1 version there was a privilege to check for empty conditions.
For example if a variable of type Collection has no values in it and we want to write a condition for this check, we used to write like
variable.empty == true
This was a valid rule for Drools 5.1.1. But now when I try to do the same in version 5.4.0, it is not supported. I tried to search for some alternative but could not find one.
Can someone help with this.
With List<String> authors in Book and the appropriate getter, this rule works fine in 5.4.0 and 5.5.0:
rule noAuthors
when
$b1: Book( authors.empty == true )
then
System.out.println( "No authors: " + $b1.getTitle() );
end
There may be some other snag in your code. What makes you say "not supported"?
Have you tried just accessing the properties of your collection? i.e.
Collection( size == 0 )
... will match any Collection which is empty.

How to check for item in documentElement, 'in' is not working

In JavaScript I have this test 'ontouchstart' in document.documentElement. If the event exists (even if null) it evaluates to true otherwise to false. I don't know how to do the equivalent in CoffeeScript. Writing it exactly as is translates to using an __indexOf function which does not do the same thing (it is always returning false).
You can also try 'onmousemove' for an event that always exists.
Use of instead :
'ontouchstart' of document.documentElement
From the documentation :
You can use in to test for array presence, and of to test for
JavaScript object-key presence.

Reuse of conditions (when) in Drool DSL statements

Is it possible to reuse a when/condition statement into another when/condition statement in a DSL file?
For example, I have two conditions:
[condition][]The client is invalid = Client( name == null || email == null )
[condition][]All the clients are invalid = forall( Client( name == null || email == null ) )
Note that the second condition just diff the first for the forall command, but the statement inside is equals. In these case, I want to reuse the first condition into the second.
Is it possible? How?
Thank you.
even the most recent version of drools will only let you substitute values into a template from pojo's or a corresponding map as per their documentation here.
This won't work for your use case though.
Since drool files are simply text files, there is nothing preventing you from considering a more powerful templating toolkit.
Possibilities include Apache Velocity, ANTLR or Scala!

How does one pass null values to optional parameters in a Business Objects report using the Business Objects SDK?

I am building a web front end for accessing Business Objects reports using the Business Objects SDK for .NET. I have been able to hack my way through 95% of the business requirements with the sparse documentation and forum posts available online for the topic. My final roadblock centers on working with parameterized reports. Our business has situations in which a report has two parameters and the end user is only requried to populate one of them. It's easy enough to collect and cleanse this data, but no matter how I try to pass the null valued parameter to the reports, I get no data back. If both parameters are populated I DO get the expected data. When stepping through the code in Visual Studio I see that whenever BusinessObjects returns a null valued parameter it displays as an empty string (""). I have tried passing this as a parameter value and have also tried assigning the parameter a value of null. Neither of these options returns results once the report is scheduled and run. I have an example of my parameter assignment code below using each of the approaches that I've taken (We need to check for a string valued "null" as the user's have requested the ability to type "null" and have that passed to the report). None of these produce a report that contains data.
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : String.Empty;
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : "";
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : null;
Is there a specific value that the Enterprise Server uses to indicate null, such as dates are required to be wrapped in Date()?
Edit: The functionality I need to duplicate as seen in InfoView:
In Web Intelligence, by default all prompts are required and you must provide a value for it via the SDK. As of BusinessObjects XI R3 it is possible to actually configure the prompt in the report to be optional. This configuration is done by the report writer. When the prompt is optional then you can opt to not set the prompt value when working with the SDK.
An alternate way to have an optional prompt is to make the prompt "matches pattern" or if it is a date, figure out a default value. When the prompt is meant to be optional and is "in list" then you can set the value to be "%" which, while for a date, set the default value.