This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Designer 2021.02 - Behavior with empty inputs and default values

We have noticed an incorrect behavior for us when using default values and would like to

know from the community if this is normal behavior or a bug.

In a subflow I have set a default value for an input. This should be used if the input is not used. (gray)

If I insert the subflow into my flow and give the input an empty value ("), then the default value is used in the subflow.

From our understanding, we would have expected if I "activate" the input field and store some values, such as get('input', ''),
then this value should be used in the subflow, as it was a conscious decision from the developer.

Currently the check seems to only look at the value if it is null or none.

Shouldn't it rather be evaluated whether the input is used at all?

Cheers

Robert

  • 0

    Hi Robert,

     The default value of an input is used only if at the execution time of the step there is no other flow variable or system property with that name that has a value different than null.  This means that if at the time of using the value there is only nulls  the default value is used.

    Now in your case in order to achieve the usage of null with empty flow level input there are a couple of options:

    - change the logic so that the default value of the step is null and make sure to always pass a value to the flow level input when non-null is required

    - designate a value to count as the deliberate null (meaning  you don't want to use the default value and you expressly want to use null for that input) and adjust the flow logic before the step to  define the value for the input: if null use default, if not null use value or if deliberate null  use null.

    In my view the second option is the best option since it can validate the intent and also clear out possible error cases.

    Hope this helps,

    Vlad

  • 0

    hiho,

    we noticed the same: Null or emtpy will be interpreted as null. 

    On the other hand your are not able to assign '' directly as input. You will receive an error: The required input cannot have an empty string value  (This error will not be displayed when using otherwise option)

    To achieve your goal and avoid the default value you may consider the following:

    • use ' ' not '' as otherwise option
    • on first use trim() the value on the input tab (and assign it back on the output tab)

    This ends in an empty (non-null) string. But in the end everything is represented as a string ;)

    Greetz Rene