Math - Pick the smallest number from list

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?
 

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
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('.', ',')));
 

convict29

Пользователь
Регистрация
10.07.2014
Сообщения
114
Благодарностей
3
Баллы
18
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
 
Последнее редактирование:

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
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;
 

convict29

Пользователь
Регистрация
10.07.2014
Сообщения
114
Благодарностей
3
Баллы
18
:/ Thanks for your effort, now the result is "360.00" instead of "3.60"
 

convict29

Пользователь
Регистрация
10.07.2014
Сообщения
114
Благодарностей
3
Баллы
18
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!
 

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