Announcement

Collapse
No announcement yet.

Problem with formula array/push

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with formula array/push

    Hi, I would like to achieve the following:

    I have a detail form, where I have numerous fields to be filled in. Not always all necessary data is available without further researching. So the records ar more or less incomplete. Any field, which cannot be filled in the first round will have 0 value in case of currency or numbers, integers and float, all other fields will either be empty or will have a value of "unknown".
    The other fields are multi-enum, enum or text.

    So I would like to have all field names displayed, which were not filled out in another entity, which has the only field a list array, where I want to push all the fields, which are empty.

    As example, lets say I have a field "Update cycle" (an enum) in the main entity (entity1) with the value "unknown", I set the formula in the entity for missing Values as:

    Code:
    ifThen(
    entity1.updatezyklus == 'unknown',
    missingValues = array\push(missingValues, 'Update Cycle');
    which means, if in entity1 the field value is "unknown", there should be pushed the value "Update Cycle" into the array (named: missing Values) in entity2.

    So far this works for enum field, but not for text or integer, currency, multi-enum or float.
    Any hint appreciated, thank you.

  • #2
    Meanwhile I found a solution.

    If there is no value known for a field, leave the field empty. In case of multi enum provide empty as option. The fields cannot be mandatory, because this would mean it could not be empty.

    The formula needs a modification:

    Code:
    ifThen(
    !entity1.updatezyklus,
    missingValues = array\push(missingValues, 'Update Cycle')
    );
    Now every field with empty value will be added to the list.​

    Comment


    • #3
      I recommend relying on null. For multi-enums, I believe we use an empty array. So for them, use:
      Code:
      array\length(field) == 0
      .
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...
      X