Last post May 27, 2021 10:02 AM by MiguelMi
May 26, 2021 02:56 PM|MiguelMi|LINK
I currently have the code below to perform the filtering of the status field.
It works well with values or string, but I intend to list where the status field is null, in my idea replacing the value or the string with null would result, but when I run it is returned zero values.
if (startStatus == "Vazio")
proResult = proResult.Select(x => new OrdersColorsViewModel
order = x.order,
malha = x.malha,
preco = x.preco,
promalha = x.promalha,
colers = x.colers.Where(c => c.status.Any(k => k.Status == null)).ToList()
}).Where(m => m.colers.Count() != 0);
I did a little test on my view and it works well
@foreach (var item4 in item2.status.Where(x => x == null))
Is any difference in reading the null state being made?
for those who want to have a little idea of what's going on: https://forums.asp.net/t/2174909.aspx?List+status+by+line
May 27, 2021 09:13 AM|ChaoDeng|LINK
Does your test data have the value of Status as null?
If there is none in the test data, the number is 0. You can check the value of proResult.
May 27, 2021 10:02 AM|MiguelMi|LINK
Yes some of my Status fields are as null in the database, and I intend to return them as you can see on the image.
in my logic (Status
it was supposed to work like that,(Status
== "Status1") right?
update: logic works!