Hello.....
In my program I have 3 variables, say
a = 10
b = 20
c = 30
I have a variable as string
vformula = "a + b + c"
I have to evaluate the formula and get the result as 60
ie ; myanswer = SOMEFUNCTION(vf ormula).
I tried using Scriptcontrol.E VAL function. But I can use only " 10 + 20 + 30".
Also, when I browse thru net I found something lilke CInt(a) + CInt(b) + CInt(c). This is also not applicable since I wont be knowing the formula & variables in advance.
Pls Help, thanks in advance....
Regards
Reshmi
3 2039
I suggest you try the search box, up top. This question has come up before. The answer, as I recall, involved the use of the MS Scripting Runtime.
Hello
Thanks for the reply.
I have tried Script Control, but using this I can evaluate only " 10 + 20 + 30" not "a + b + c".
Regards
Reshmi
I suggest you try the search box, up top. This question has come up before. The answer, as I recall, involved the use of the MS Scripting Runtime.
I have tried Script Control, but using this I can evaluate only " 10 + 20 + 30" not "a + b + c".
Hm... not sure how you'd go about this.
At the simplest level, of course, if you know the variable names that can be used, you could do a substitution in the string before submitting it for processing. In other words, replace a with the value of a, b with the value of b, and so on.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ernie |
last post by:
Hi,
I spent more than an hour wondering why the following works in my
Python 2.3.4 Linux box:
formula = """
def dummy():
print "This is Ok!"
"""
|
by: Coco |
last post by:
Hi!
Does c# has any class method that will be able to evaluate
a given string e.g ((True && False) || (True && True)) and
return the result in boolean for this case is true
Thanks!
|
by: VM |
last post by:
If I have a string variable with a formula:
string sMyformula = "3.3*5.2*5";
How can I convert this to a mathematical formula that the compiler can
calculate? For all purposes, the formula in the string will always be valid.
Thanks
|
by: sal |
last post by:
Greets, All
Converting array formula to work with datatables/dataset tia sal
I finally completed a formula I was working on, see working code below.
I would like to change this code so it will work with a variable mutl-
row, 5 column datatable where the users select items. Anyone have any
suggestions on where to start?
Or changes in the current code that might be made.
|
by: S. Olivier |
last post by:
Hey, again!
How to evaluate a formula (stored in a field as "X / 60") replacing the "X"
with a number? I replaced the "X" with a selected number but can't figure
out how to obtain the result...
Let's say X / 60, replace X with 120, my variable contains "120 / 60". Now,
how do I get the resulting value? EVAL (MyVar) ??
Thanks
| |
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
I have a custom business object of type Person.
i created a page with check boxes that will post to a second page that is
strongly typed with the first page and i have a function that retreives all
the checked boxes from the first page. The ID value of each checkbox is the
name of a property in the business object (Name, Address, Phone, ...). I can
get all the ids no problem here.
Question is there a way to convert or evaluate a string...
|
by: patrickahutah |
last post by:
I need some help on computing this formula especially the best way to capture the data that is whether to use excel or ms access, then with the data compute the formula. The excercise is for bonus scheme calculation which is depended on various performance indicators.
Global Incentive (GI)
General Formula
GI = {(By-1) * (P/N)} + {X * (COMa-COMm) * (WRpa+UFWpa+CEpa+MRpa+TApa)
GI = Global Incentive that relate to the entire company
By-1...
|
by: Monusonu |
last post by:
Hi Expert,
I am trying to get the value from excel formula cell using POI. My code works fine for less complex formula cells, but fails or returns error code for complex formula cells.
Following is the code I am using to get values:-
public class POIMain{
public POIMain() {
}
public static void main(String args) {
try{
|
by: Barry L. Bond |
last post by:
Greetings!
I just got a new Peet Brothers Ultimeter 2100 Weather Station. This
new one has a way to display the heat index, if you press the "dew point"
key twice.
Being aware of all the controversy surrounding the exact calculation
of the heat index, I would like my own software (which I programmed in the
1990's, when I got their Ultimeter 2000 weather station, but that one
didn't show heat index) to display it. Living in Florida,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |