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