How to show single condition card instead of multiple on contacts

hello @marc @jkuester

sorry for bringing this back

as seen in the screenshot below, when the care assessment form is filled more than once then the condition card appears more than once which makes it abit congested

we wanted to always only display the conditional card to display the risk category for the latest submitted care assessment form ie only appearing once

{
    label: 'task.risk.status',
    appliesToType: 'report',
    appliesIf: function(r){
      return r.form === 'care' && contact.type === 'person';
    },
    fields: function () {
      const fields = [];
      var careReport = getMostRecentReport(allReports, 'care');
      console.log(careReport);

   
    fields.push(
      { label: 'task.risk.category', value:  getField(careReport, 'care.category'),   width: 6 }
    );
    return fields;
    }
  },

Looks like you can achieve what you want by including a check that the form is in fact the newest one in the appliesIf condition.

For instance, something like this may work:

    appliesIf: function(r){
      return r.form === 'care' 
          && contact.type === 'person'
          && r == getMostRecentReport(allReports, 'care');
    },

Let us know how it works out!

1 Like

thanks @marc , works fine

1 Like