Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to filter subform with value in parent form Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

How to filter subform with value in parent form

Unread post 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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: How to filter subform with value in parent form

Unread post by kev1n »

Yes, subforms support filtering. I'll share an example shortly.
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: How to filter subform with value in parent form

Unread post 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
Post Reply