Maximum Capacity check

Maximum Capacity check

Hi,

 

I build a script that was supposed to check a field value on a related form (Maximum Capacity) and then compare it to the count of specific records. And show an alert if it was reached. See below

 

if (input.Britcham_events  !=  null)

{

    Cpct = Britcham_events[ID == input.Britcham_events].Maximum_capacity;

    Trgt = Britcham_events[ID == input.Britcham_events].Target_nr_of_participants;

    cnt = Participants[((Status == "Attending" || Status == "Confirmed") && ID == input.Britcham_events)].count();

    if (cnt  >=  Cpct)

    {

        alert(((cnt + " are registered. The maximum capacity is ") + Cpct) + ".");

    }

}

 

I am not sure but currently the script does not work? Can anyone help?

 

Best,