Evaluate a string

Evaluate a string

Is there a way to evaluate a numeric expression contained in a string and return the numerical result ? ie: "3*(4+2)" return 18 Just like NCALC http://ncalc.codeplex.com/ Antonio
Make an extension with NCalc in it :)
(or at least the dll, seems it is c#)
Yes, that will be my next step. Hoping that there is some kind of native solution. It will be my first time, so it will not be without pain. :) But will have some fun, though. I hope. Antonio
It's a good chalenge for a first time experience.
It would be interesting sharing with the community an Outsystems Extension wrapper for the http://ncalc.codeplex.com/ 

We are here to help you.

It seems that J2EE was on the way...for now is solved.


My problems started with the configuration of integration studio.
After importing the dll to the IS, when I try to verify it, I get the message:
"Integration Studio options are not correctely defined. Do you want to define them now?"
I went trought the help and dont know what to do next as this message keeps on showing up.

I've choosen only .NET

Dont know what to put in "Compare files using:"

.NET IDE is blank
I have Visual studio 2010 instaled but dont have (or cant find) any vcsexpress.exe

.NET compiler I have "C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" and the file exist in my comuter.

Im stuck here so dont know what to do next.

Maybe somone can help me.
I prepared an extension with the ncalc.dll, and prepared an app to test it.
It runned well until I moved the ncalc.dll from the desktop, where I tested it, to a folser in my hard disk.
Deleted the  extension from the server, prepared a new one from the DLL's new location, refreshed the reference to the xif in the application, and now it doesnt work anymore.
The error I have in the browser when running the application is:
Could not load file or assembly 'file:///C:\Program Files\OutSystems\Platform Server\running\NCalc.0811731805\bin2\NCalc.DLL' or one of its dependencies. The system cannot find the file specified. 
The file ncal.dll is not inside the \bin2 but it is in \bin.
Tried everithing including (sigh!) reinstaling the outsystems platform.

I do not know what I can do next. Any sugestion?
Before the prior problem I had the basics working:
- Create an object "
expression" with a text string containing the expression to be evaluated as input
- Evaluate action calculating the value of the "expression"
- An action to check if text expression had errors

Another problem I had is that the result remains in the object expression.
Althought I can see the result in the debugger, then I have the error
"Invalid Data Type 'Text' data type required instead of 'Object'"
when I try to assign the value.

Can somone help me what sould I do now? 
Hi António.

Are you still stuck with that error?

If you need some help, you can attach the .oml and the .xif, i will try to help you.

Daniel Martins.
Yes still the same situation.
Here they go!
Hi António.
I never used the Import Actions from .Net Assemby functionality, but something went wrong during your import, i also tried and i gave up. Because that import added wrong references to the project and weird references locations c:\Bin....
Create a new extension, create the 3 methods (Actions) and the respective input and output parameters. Then edit the extension's code. In the code, do a reference to your DLL, and make sure to set "Copy Local = True".  Call the DLL methods as needed.
Please try the  OML and the new extension attached.

Hope this solves your problem.
Daniel Martins
This is not forgoten, but I found a better way to make the calculations.
Send the formulas to the SQL server and it will solve them for me.
Nevertheless, I will return to this later on when I have spare time.



Have u tried using Javascript?  http://www.w3schools.com/jsref/jsref_eval.ASP
I think it should be possible with jquery to...

best regards,
Luis Paulo Soares
Hello Daniel

I tried to see what you sent me and I had this error when I tried to import the .xif, you sent me, to the IS:
"You are trying to Upload or Publish an Extension whose Intellectual Property is Protected, since it was created in a different Agile Platform Infrastructure than ''localhost''. To obtain the Intellectual Property Rights for using this Extension in ''localhost'' Infrastructure, please go to OutSystems' Intellectual Property Services at 'http://www.outsystems.com/ipp'."

How can I import this .xif?


Please follow the steps at http://www.outsystems.com/ipp

You can upload the .oml and the .xif files and you will receive IPP free files at your e-mail.

Daniel Martins.

I'm trying to implement  NCALC.DLL to evaluate a string (i.e."2+2")
The result is an object. Althought I can see the correct result in the debugger (the value of the object will be "4"),  then I cant see any way to show it in a web page.
I need a Text instead of an object. 
Can somone help me how I can do this? 
Hi Antonio,

Edit your extension and change the return method from object to text ..and then do the cast inside the extension code.

João Rosado


Four years since the last post about this matter, I have the same problem. I need a way to evaluate a numeric expression write in a string (i.e, "2+2"). There was some conclusion about? I searched in the forge and found only one component (Evaluator), but generate an error when the extension is published.

Can someone help me?


Roberto Campos


NCALC worked just fine for me.

Hi Antonio,

Thanks for your attention, How can I get the NCALC ?

Best Regards,



And then use Integrations studio to create Actions

I created a simple wrapper around it, plus fixed the decimal/double/single stuff (see the NCalc website). You can find it here. Since we are on P10, it's P10 only, so I hope you're on P10 :).

Hi Kilian,

Thank you very much by your attention.

But the problem is that I am using the Outsystems Cloud Personel Environment, and the version is It doesn't installed because there was version conflict. Is there a version 9 to your component?

Best Regards,


I was afraid of that :). Do you need version 9.1? Because you can request an upgrade to 10. I can see if I can create a v9 one, but it'll take some time.

Can I ask the version 10 to a free outsystems cloud personel environment?

As far as I know, yes. My cloud environment is also v10.

Thanks Kilian, I will ask a new version!!

Hi Kilian,

I followed your recommendations, and my environment was already upgraded to version 10. Then, I installed your MathExpr component, and it works fine. I'm writing a applicative to industrial segment, and you gave me a GREAT help. Thank you very very very much by your attention.

Best Regards,


Hi Roberto,

Great to hear it worked. If you like, please rate the MathExprEval component, since you're the first one to use it :).