Button visibility dependent on boolean field

Hi there :slight_smile:

I am trying to configure a button whose visibility is dependent on a helper-boolean field. The helper field is inside a CombinedDataModel:

Dependent fields:

  • bookingPeriodEnd
    ** Model: Booking (included in CDM)
  • ExpiryDate
    ** Model: Contract (included in CDM)

What am I trying to do:

  • if bookingPeriodEnd >= ExpiryDate → show button in ContractCDMForm
  • if bookingPeriodEnd < ExpiryDate → Show (booking-) Button in ContractCDMForm

The ContractCDM includes the Booking model with a multiplicity of 999.999

I tried to accomplish this with:

  • define a helper field CriteriaNextInstallmentButton in the ContractCDM model also with the calculation of the field CompCriteriaNextInstallmentButton.

Formula:
Condition:

AtLeastOneFieldFilled(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd)
AND
AtLeastOneGroupFilled(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd
  Having [/ContractBooking_relationship/Booking/BookingMetaData/bookingPeriodEnd]
  >= [/Contract/ContractData/Dates/ExpiryDate])

Calculation result: false

And for true:

AtLeastOneFieldFilled(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd)
AND
NoGroupFilled(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd 
  Having [/ContractBooking_relationship/Booking/BookingMetaData/bookingPeriodEnd]
  >= [/Contract/ContractData/Dates/ExpiryDate])

In the form a dependent control on the boolean field was set.

Problem: The calculation does not work: In the designated screen when ExpiryDate = bookingPeriodEnd. The result of the field is then true instead of false.

Another approach was done with the following formula:

[/Contract/ContractData/ContractStatus] !="policy-created"
Or
NumberOfFilledFields(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd
  Having [/ContractBooking_relationship/Booking/BookingMetaData/bookingPeriodEnd]
  >= [/Contract/ContractData/Dates/ExpiryDate]) >= 1

which resulted in the field not being calculated at all (-keine Daten-)

Does someone has an Idea how to solve this?

If you need more information please ask :slight_smile:

Kind regards,

Timo

Hi @timo-thin-buffer,

Firstly, you can simplify your computations as the Group is filled as soon as a Field within it is filled. (See solution at the end).

These computations appear to work when I test them. The issue is with your Comparison Operators. You have modeled the same Filter condition for both preconditions.

  Having [/ContractBooking_relationship/Booking/BookingMetaData/bookingPeriodEnd]
  >= [/Contract/ContractData/Dates/ExpiryDate])

If ExpiryDate = bookingPeriodEnd then this is true.
You just need to modify the first precondition to be

AtLeastOneFieldFilled(/ContractBooking_relationship*/Booking/BookingMetaData/bookingPeriodEnd
  Having [/ContractBooking_relationship/Booking/BookingMetaData/bookingPeriodEnd]
  > [/Contract/ContractData/Dates/ExpiryDate])

This then works in my test model (2023.06-ext6)
Contract_DM.json (4.4 KB)

Yes this is true, still the problem exists after fixing that typo. (I think i retyped this formula so often that i had every case once put in ^^)

In this picture you see the result afters fixing the typo:

I am also a little confused by your solution:

Doesnt the first precondition have to be ā€œ<ā€ instead of ā€œ>ā€

I’m definitely confused :rofl:

If you take a look at the model I attached, I modeled the True and False statements the wrong way round. Once I remodeled this correctly, the Computation Rule worked as expected with no need to change the Comparison Operator.

Corrected 2023.06-ext6 model
Contract_DM.json (4.4 KB)

Update

The original Computation Rule is acceptable (if a little over-complex).

Testing in the SME shows the rule working correctly. The error is only observed in the Project environment where bookingPeriodEnd fields are created and filled automatically.