+ Start a Discussion
Lalitha Pavani Rallabandi 13Lalitha Pavani Rallabandi 13 

Display fields only if the values are not null or blank for a dynamic SOQL Query

I stored all the editable fields in a variable and calling the variable in a dynamic SOQL query.
My Query: 
String fieldApiList = String.join(fieldsApiNames, ',');
        query = 'SELECT Name,'+ fieldApiList +' from EP_Service_License__c WHERE ID IN:recordIdSet';
Now, using a VF page I am displaying the fields and its values like as follows
User-added imagemy requirement is, if any field value is null or blank in the selected records or any field values is same in all the selected records then I should not display that field. 
For example, here in the picture, product license number is same for all the selected records and Copy Primary Prod Co License(s) field is null for all the selected records. Now, I should avoid displaying those two in the output. This should happen dynamically for all the fields.

Kindly help me on this
SwethaSwetha (Salesforce Developers) 
HI Lalitha,
This appears to be the same ask in https://salesforce.stackexchange.com/questions/311411/display-fields-only-if-the-values-are-not-null-or-blank-for-a-dynamic-soql-query

Can you try the approach mentioned by experts and see if it fixes the issue.Thanks
Lalitha Pavani Rallabandi 13Lalitha Pavani Rallabandi 13
No those are not helpful
SwethaSwetha (Salesforce Developers) 
Can you please clarify and elaborate where exactly you are stuck in trying the suggestions stated in the StackExchange post? Responding on the thread with more information will notify them and help you with a solution. Thanks