Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Field to count number of subforms (patients)

Angusdog
Level 1
Level 1

Hi,

New to Designer and making some headway...

I've got a field to count the number of patients on a form. Each patient's details are in a subform, which is within a container. There's buttons to add or delete a patient/subform which is working fine.

I'm struggling with getting the field to show the number of patients/subforms.

I've put this code into the 'calculate' event of the field:

$.rawValue=Count(PatientContainer.PatientDetailsSubform.Line1[*])

'Line1' is an element withing the PatientDetailsSubform. I did have it as 'Surname' but the count only goes up when it's non-null and even then it only seems to count the first subform. To be honest, Line1 doesn't work at all...

Thanks in advance,


Simon.

1 Accepted Solution
Bibhu_Bikash_Na
Correct answer by
Level 9
Level 9

Hi Simon,

You can use the instanceManager() to count the numer of subforms. As you have mentioned PatientDetailsSubform contains the information about the patient so you can count the instances of this subform to get the no.of patients.

var patientCount = PatientContainer.PatientDetailsSubform.instanceManager.count;

Thanks,

Bibhu.

View solution in original post

2 Replies
Bibhu_Bikash_Na
Correct answer by
Level 9
Level 9

Hi Simon,

You can use the instanceManager() to count the numer of subforms. As you have mentioned PatientDetailsSubform contains the information about the patient so you can count the instances of this subform to get the no.of patients.

var patientCount = PatientContainer.PatientDetailsSubform.instanceManager.count;

Thanks,

Bibhu.

View solution in original post