When a query is performed the response is a dataset which contains a dictionary. The issue is that the dictionary does not have the proper type casting for the attributes (they are just any types). This means that anytime a comparison has to be done, or a wherecontains is used we must first convert the result of the dataset into a proper data type.
Side note, can we just make wherecontains perform basic type casting.
Discussion posts and replies are publicly visible
Joshua F said:Side note, can we just make wherecontains perform basic type casting.
+1 to that!
I agree. When passing values, Appian does a great job in automatic type casting. With comparisons, it does almost nothing. Annoying!
BTW, did you know that if() is pretty flexible. null, 0, 1, 42, -21, "true", "false", true, false, "yes", "no" - you can throw almost anything at it.
The issue with type casting query results automatically is that with the ability to set a specific subset of columns to be returned, this would cause a cluttery mess when you only need one column from a query for instance. Of course there's nothing keeping you from type-casting the results yourself in your Query Entity expression rules against your commonly-used Tables/CDTs.
I think a stronger general-level approach would be to have a!queryEntity return a datasubset where the data element contains an array of Map instead of an array of Dictionary. AFAIK this would be generally back-compatible with most (or all) use cases, and also solve a lot of the nitpicky issues caused by vaguely-typed dictionaries.
Just FYI - our new function a!queryRecordType() returns a different type: a record map. The record map gives you the benefits of a map (strongly typed columns, doesn't break if you index a field that doesn't exist) and the overall type is a record data type, so you don't have to do any casting when you need the whole record.