If a query entity returns an empty set (due to the filters), will that empty set

Certified Senior Developer
If a query entity returns an empty set (due to the filters), will that empty set be automatically cast to the type of the Data Entity, or do we need to perform this cast in our rules to ensure the query entity is null-safe (it always returns the expected type, whether it is an empty array or not. Otherwise using dot-notation to access fields of a CDT will result in errors, although the property() function would also let us be null-safe)....

OriginalPostID-131791

OriginalPostID-131791

  Discussion posts and replies are publicly visible

Parents
  • Yes, but the result of queryEntity as a whole (which includes paginginfo in addition to data) is a datasubset. As for the .data part, the type is shown to be "List of Variant" (CDT) even when the data is null, so casting may not be required. You can check using typename(typeof(<data>)) and see that it returns the same type in both cases.
Reply
  • Yes, but the result of queryEntity as a whole (which includes paginginfo in addition to data) is a datasubset. As for the .data part, the type is shown to be "List of Variant" (CDT) even when the data is null, so casting may not be required. You can check using typename(typeof(<data>)) and see that it returns the same type in both cases.
Children
No Data