AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.05.2009, 09:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
gatesasbait: Basic calculator using runbuf() in Dynamics AX
Источник: http://gatesasbait.spaces.live.com/B...B9F5!398.entry
==============


Good evening,

If you ever need to build a mathematical calculator in Dynamics AX, you might consider using runbuf() as basis for the code. The only critical considerations are to make sure that an attacker cannot use the calculator to execute code other than mathematical functions.

Here’s a quick example of what the calc() code for the calculator might look like (in a job):

X++:
public static void calcExample(Args _args)
{
 real ret;
 str formula = "(30+20)*(2)"; //user might type this into a textbox on a form
 ;
 ret = runbuf(
 strfmt(
 "real calc()\n"
 +"{\n"
 +"    ;\n"
 +"    return %1;\n"
 +"}\n", formula));

 info(SysQuery::value(ret));
}

An added advantage of using runbuf() this way, is that it gives the user the ability to use mathematical functions defined in AX like abs() acos(), asin(), atan(), etc.



Источник: http://gatesasbait.spaces.live.com/B...B9F5!398.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Developer for Microsoft Dynamics AX Certification Roadmap Blog bot DAX Blogs 1 13.05.2009 16:17
gatesasbait: Support of basic operations on Sets in Dynamics AX Blog bot DAX Blogs 0 11.11.2008 22:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Inside Dynamics AX 4.0: Usage Scenarios Blog bot DAX Blogs 0 04.10.2007 05:15
Сергей Герасимов: Что нового в Microsoft Dynamics AX 4.0 Blog bot DAX Blogs 0 16.01.2007 11:00

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 07:13.