Hi @user70744,
There is a way around this but it is not the best approach. If you want to do the filtration on the server side you can use the Content Fragment API and check if the element exist and do a null check for the value.
Resource fragmentResource =resourceResolver.getResource(contentFragmentPath);
ContentFragment contentFragment=fragmentResource.adaptTo(ContentFragment.class);
ContentElement element = contentFragment.getElement(elementName);
if (null != element && null != element.getValue() && null != element.getValue().getValue()) {
//your logic
}
Create a model with all the fields(data members) as in content Fragment. In the dialog just give a pathfield to select the desired CF. You can make it a multifield incase you need a list of CF's to populate.
You can set the fields of the model depending on the non null values of CF as given in the code snippet and read the same in your htl(sightly).
This is just a way around if you need to filter non null values on server side.
Let me know if it suits your use case.