How to hide record when the value is null/empty

How to hide record when the value is null/empty

  

Hi Everyone,

(Edited)

It is possible not to display the entity attribute if we detect that the value is null/empty?

For example as below, i have displayed the record in accordion items, it detect that the email value is empty, thus i want to remove the email from the accordion items. (I do not want to display empty value as it is quite ugly)

Hi XL Jace,

You can define one css class as

.Hide {

display:none;

}

and on extended property of row do this settings.

Thanks and Regards,

Suraj Borade

Hi Suraj Borade,

Thanks for the reply.

How about the record is in the accordion items? How do i move the next record up? refer to the example shown, the accordion items shown should be name, gender, phone and address.


Hi XL,

I'm not exactly sure what you mean by table record, so I'll first give the answer I think you're looking for, and then an alternative to what Suraj suggested.

If by "table record" you mean an Entity record, then there is no way of removing Entity Attributes if they are empty. In the image you showed, I'd just "Enclose in If" the AccordionItem and as condition check if that record's Email Entity Attribute has a value different from its default value. This way the AccordionItem would not be on the final web page if the Attribute was empty.

-- / --

What Suraj is suggesting is assuming when you mentioned "table record" you were actually talking about using the TableRecords widget... I don't think this is the case, given your screenshot, but nevertheless (and given the topic might catch the eye of other people with that issue), I'd like to provide an alternative to Suraj's. 

Why not make sure that the Source List doesn't have records you don't want to show? Your page will be leaner and faster to load (especially if there are many records like that):
a) you wont fetch unnecessary records from the database;
b) you wont generate HTML for unnecessary records in the TableRecords that you then hide via CSS.

This sort of filtering can easily be done in an Aggregate by adding a filter checking whether the relevant fields are different from their default values (for emails it would be the empty string: "").

Or you might want to consider using the ListFilter action from OutSystems 10.

Hi XL Jace,

Do you want to hide the record if there is null/empty value. for example,

If email value is null then email block will not display.


If you want this you can do this using if block(present in tool),

I implement similar things, check it out in this image.


 


Hi. Thanks for your help  

Always welcome ;)

Hi Jorge Martins,

I have rephrased my question abit. I do not need to remove the entity attribute but just want to hide it when there is no value. There is a possibility that there is value in the email, so i cannot filter off it.

Hi Gopal,

Thanks for the explanation, i will give it a try. :)

Hi XL Jace,

Given the rephrasing, my initial answer (in bold below) will be the simplest solution to your issue.

Jorge Martins wrote:

If by "table record" you mean an Entity record, then there is no way of removing Entity Attributes if they are empty. In the image you showed, I'd just "Enclose in If" the AccordionItem and as condition check if that record's Email Entity Attribute has a value different from its default value. This way the AccordionItem would not be on the final web page if the Attribute was empty.

Do share with us how you ended up solving your problem.