Check if filled fields in repeatable group equal value

Hi A12 -Team :slight_smile:

I am trying to check if a specific field in a repeatable group equals a specific value. Example:

Condition:
AtLeastOneFieldFilled(Group*/Field) AND [Group*/Field] == “completed”

This does not work. The only thing that I thought of that might work is this:

NoFieldFilled(Group*/Field Having [Group/Field] != “settled” AND FieldFilled(Group/Field)) AND AtLeastOneFieldFilled(Group*/Field)

Is the are more “elegant” solution to this?

Kind regards.

Hi @timo-thin-buffer

Are you looking for something like this?

AtLeastOneFieldValueIncludedInValueList(MyRepeat*/MyField In "settled")

This Validation Rule fires once if there is one or more rows in the Repeat where “settled” was entered. The Error Message is shown on the first row of the repeat or on any non-repeatable Error Field that you might want to use.

RepeatValue_DM.json (3.9 KB)
(2024.06 model)


Hi @malcolm-silver-ice ,

thanks for the answer. My goal is to check if all filled fields are set to a specific value. I.e. if all are “settled”.

So I need something like: AllFieldsValueIncludedinValueList(Group*/Field in “settled”)

I thought this might be the case so I put an easter egg in my model.

In the repeat there’s another simple Validation Rule

FieldFilled(MyField) And
[MyField] != "settled"

This will check each row one by one. Any row that is not “settled” will be marked.

Ah good idea!
I might should have described more precise what i ment.

So the goal is to have field that describes if the field of a repeatable group is set to “settled”. And this for all filled entries.
RepeatValue_DM.json (5.3 KB)

I attached your Model and adjusted it with “pseudocode” to make it more clear.

Soooo… looking at your “pseudocode” you want to

  1. Compute a value “settled” if all Fields in a repeat have the same value, “settled”.
  2. Compute a value “unsettled” if one or more Fields in a repeat do not have the value “settled”

Based on the test model, where we have two different values for the Field in the Repeat we can do something like this:

  • Model a Common Precondition to check that at least one field is filled
AtLeastOneFieldFilled(MyRepeat*/MyField)
  • Model a precondition to check that no different values occur. In our case, we use the other value in the ValueList, “not_settled”.
  • The Computation result is “settled”
NoFieldValueIncludedInValueList(MyRepeat*/MyField in "not_settled")
  • Model a precondition to check that one or more value does not have the value “settled”
  • The Computation result is “unsettled”
NotAllFieldValuesIncludedInValueList(MyRepeat*/MyField In "settled")

Adapted 2024.06 model
RepeatValue_DM_2.json (5.5 KB)

Basically, yes there are elegant ways to model your condition. However, sometimes you need to be able to flip an idea in your head before you can see the elegant solution. Try writing your precondition out in normal language / pseudocode but looking at it from different angles before you start searching for the perfect language construct.

Thank you very much, especially for your precise solution :slight_smile: