Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Unexpected operator in advance criteria

    Hi Isomorphic

    I'm encountering an unusual behavior in AdvancedCriteria produced by my DynamicForm. I have a 'SelectItem' component with value map set and have no operator explicitly set for the field attached to the form. I'm generating AdvancedCriteria by calling DynamicForm.getValuesAsAdvancedCriteria(). Based on my understanding the default operator for a SelectItem with a valueMap should be "equals" but instead I'm seeing that the criteria getting generated has "icontains" operator.

    I don't want to explicitly set the operator for this field but rather prefer to have "equals" operator returned by default, as expected. Can you explain why "icontains" operator is getting returned by default? Why might this be happening? Am I missing any additional configuration or settings? Also, this issue did not exist in the previous version of smart GWT (version 5 I believe) which was being used.

    current smart gwt version - 13.0-p_2023-05-06

    I did some digging and found out that earlier Smart GWT used to return "equals" operator if the field has a valueMap, or a optionDatasource etc. Inline with the documentation. But in the latest version (v13) it first gets the default operator ("iContains") based on the field type which is 'text' and then performs some checks and based on that decides whether to return "equals" or the default operator.

    Code:
    if (this.valueMap || this.optionDataSource || isc.SimpleType.inheritsFrom(_6, "enum") || isc.SimpleType.inheritsFrom(_6, "boolean") || isc.SimpleType.inheritsFrom(_6, "float") || isc.SimpleType.inheritsFrom(_6, "integer") || isc.SimpleType.inheritsFrom(_6, "date") || isc.SimpleType.inheritsFrom(_6, "datetime") || isc.SimpleType.inheritsFrom(_6, "time")) {
      return _3 ? _4 : "equals"
    variable _7 below is calculated and passed to the above condition as _3.
    _3 is undefined, _5 is false (set to true only when we set a operator for the field) and _4 is the default operator ("iContains" in my case)

    Code:
    var _7 = _3 || _5 || (!_5 && _4 && !(this.form && this.form.allowExpressions && _4 == "iContains"));
    Earlier version (v5.0) used to return "equals" without any checks done.

    Code:
    if (this.valueMap || this.optionDataSource || isc.SimpleType.inheritsFrom(_6, "enum") || isc.SimpleType.inheritsFrom(_6, "boolean") || isc.SimpleType.inheritsFrom(_6, "float") || isc.SimpleType.inheritsFrom(_6, "integer") || isc.SimpleType.inheritsFrom(_6, "date") || isc.SimpleType.inheritsFrom(_6, "datetime") || isc.SimpleType.inheritsFrom(_6, "time")) {
      return "equals"
    In the Smart GWT java docs it says that the default search operator for fields in a form that produces a AdvancedCriteria is "iContains" but it does not apply to special fields where exact match is obviously the right default setting, such as fields of type:"enum", or fields with a valueMap or optionDataSource.
    Last edited by mohnish_mandava; 12 Jul 2023, 08:05.

    #2
    This report slipped through the net but we've now made a change to address it.

    Please retest with a build dated September 1 or later.

    Comment

    Working...
    X