[Resolved] PM - issues with c# action

Статус
Закрыто для дальнейших ответов.

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
PM v.5.9.5.1 (latest).

Ok, so I started a thread re a solution to an problem, which you can read here.

So every time I add the c# action, I add in my (price) variable into it, like this:

Код:
double price ={-Variable.amazon_price-};
double percent =13.5;
double total = price+price*percent/100;
return total;
When I restart to the first action during a run, I keep getting the following errors:



Should I add the diagnostic file here?

Anyway, when I remove the action, everything goes back to normal again. I will add that the c# worked ok for a few times at first, then this keeps happening.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 241
Благодарностей
5 848
Баллы
113
That's not a bug. Variable in C# syntax is different - project.Variables["amazon_price"].Value
The code will look like this:
Код:
double price = project.Variables["amazon_price"].Value;
double percent =13.5;
double total = price+price*percent/100;
return total;
 

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
Ok, have now updated the code to:

Код:
double price =project.Variables["amazon_price"].Value;
double percent =13.5;
double total = price+price*percent/100;
return total;
Btw, because I cannot restart it, the amazon variable is empty. Not really sure if that throws a spanner in the works?

But now it refuses to restart and displays the following error:

 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 241
Благодарностей
5 848
Баллы
113
Код:
double price = double.Parse(project.Variables["amazon_price"].Value);
double percent = 13.5;
double total = price+price*percent/100;
return total;
 
  • Спасибо
Реакции: shabbysquire

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
Thanks Vlad! It's now working as it should. :D

Have now changed thread to resolved.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 241
Благодарностей
5 848
Баллы
113
Статус
Закрыто для дальнейших ответов.

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