Math - Pick the smallest number from list

  • Автор темы Автор темы convict29
  • Дата начала Дата начала

convict29

Пользователь
Регистрация
10.07.2014
Сообщения
114
Реакции
3
Баллы
18
Hello all,
i have a list with numbers (5.31, 5.62, 11.22, 700, 5.00 and so on)
How can i make ZP to pick the smallest number?
 
to use with text
return "5.31 5.62 11.22 700, 6.00".Replace('.', ',').Split(' ').ToList().Min(s=>double.Parse(s));
to use with list
return project.Lists["your listname"].Min(s=>double.Parse(s.Replace('.', ',')));
 
Thanks a lot man! Works almost perfect.
The issue now is that it wont replace the "." with ","
if the lowest number is 3.06 it will give it as 306. Any idea? Thanks again

*i use the list option
 
Последнее редактирование:
realy dont know why
for me it works fine
try to convert with format like that
string min = project.Lists["your listname"].Min(s=>double.Parse(s.Replace('.', ','))).ToString("N");
return min;
 
:/ Thanks for your effort, now the result is "360.00" instead of "3.60"
 
Hey i made it to work :D
I change this part here :
return project.Lists["your listname"].Min(s=>double.Parse(s.Replace('.', ',')));

I thought that is unnecessary to replaces my "." with "," and since i don't know how to remove from the code the "Replace" i did this.

return project.Lists["your listname"].Min(s=>double.Parse(s.Replace(',', ',')));

Thank for your help!
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)