Page 1 of 1
How to filter subform with value in parent form
Posted: Mon Feb 24, 2025 2:47 pm
by yvesf
Hi,
Will it be possible to filter the content of a subform based on the date in the parent form ?
Subform filtered.png
Many thx,
Yves
Re: How to filter subform with value in parent form
Posted: Mon Feb 24, 2025 4:51 pm
by kev1n
Yes, subforms support filtering. I'll share an example shortly.
Re: How to filter subform with value in parent form
Posted: Mon Feb 24, 2025 5:00 pm
by nac
Hello Yves,
There is a function in nuBuilder that lets you add filters to one or more columns in a subform. Let's assume that your subform is called
sf_one and you wish to filter on columns
one_date and
one_patient.
You can add this JavaScript to the custom edit code and it should do the job for you.
Code: Select all
var sfFilterSpecs = {};
sfFilterSpecs['sf_one'] = {
'one_date': { type: 'select', blank: false } ,
'one_patient': { type: 'search', datalist: true, blank: true }
};
nuSubformAddFilter(sfFilterSpecs);
In this example, the date filter will offer every unique date in a select object. The patient search will be in a text object with datalist completion.
I hope this helps.
Neil