473,804 Members | 4,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Custom Expression Builder / Calculation Engine

My problem is best explained by way of tables and examples...

I am using Access 2000 (in case this is relevant) and I have a table
with the following fields...

Field names
------------
Code Description Formula Value
FIN01 Dept A - Hours Worked Null 40
FIN02 Dept B - Hours Worked Null 30
FIN03 All Departments Total [FIN01]+[FIN02]
FIN04 All Departments Average Avg([FIN01]+[FIN02])

And that is reall it...
There are two problems...

The initial problem - getting a calculated value into FIN03, I can see
that I can interrogate the Formula and reading the string search for
"[field]" and do a lookup to get the value and replace the fieldname
with the returned value eg - "40+30" - I am confused about how I add
the string together - do I have to place a val() around each field -
eg., "val(40)+val(30 )" and let access work this out - or is there an
easier/better way?

The second issue is to enable the user to create functions - Live Avg -
I guess that I need to pass this string to a formula function that will
extract the string into its parts - like above - and eventually provide
a string - eg., "Avg(val(40)+va l(30))" and then create individual
functions to get the appropriate result?

Again Is there a better way?

Finally - to enable the user to enter a formula - I need to create a
data entry form (very similar to the expression builder) so that they
can enter the appropriate formula - does anyone know of web link to a
code example for what I am trying to do...

All thoughts appreciated... this is keeping me awake at night - which
after 5 days is not good!....

Thanks.

Nov 13 '05 #1
3 3995
It's generally accepted practice that you NOT store calculated values.
Doing so can and will cause problems; you can display the calculated
results when needed with no performance penalty and no worries about
refreshing old underlying values.

Unless you want your users to create 50+ different expressions (and expect
them to understand how to do so and get it correct), why not have a form
with 2-10? predefined expressions, and let the user select a specific one by
radio button selection. List the expressions on the form by their English
description, add an unbound "results" textbox, then use a command button or
the AfterUpdate event of the radio button group to run select case code to
execute which expression to evaluate and display in the results control.
-Ed

"Nigel C" <ni************ @hotmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
My problem is best explained by way of tables and examples...

I am using Access 2000 (in case this is relevant) and I have a table
with the following fields...

Field names
------------
Code Description Formula Value
FIN01 Dept A - Hours Worked Null 40
FIN02 Dept B - Hours Worked Null 30
FIN03 All Departments Total [FIN01]+[FIN02]
FIN04 All Departments Average Avg([FIN01]+[FIN02])

And that is reall it...
There are two problems...

The initial problem - getting a calculated value into FIN03, I can see
that I can interrogate the Formula and reading the string search for
"[field]" and do a lookup to get the value and replace the fieldname
with the returned value eg - "40+30" - I am confused about how I add
the string together - do I have to place a val() around each field -
eg., "val(40)+val(30 )" and let access work this out - or is there an
easier/better way?

The second issue is to enable the user to create functions - Live Avg -
I guess that I need to pass this string to a formula function that will
extract the string into its parts - like above - and eventually provide
a string - eg., "Avg(val(40)+va l(30))" and then create individual
functions to get the appropriate result?

Again Is there a better way?

Finally - to enable the user to enter a formula - I need to create a
data entry form (very similar to the expression builder) so that they
can enter the appropriate formula - does anyone know of web link to a
code example for what I am trying to do...

All thoughts appreciated... this is keeping me awake at night - which
after 5 days is not good!....

Thanks.

Nov 13 '05 #2

"Nigel C" <ni************ @hotmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .

Again Is there a better way?

Try Microsoft Excel.
Nov 13 '05 #3
To answer the above 2 posts... I agree, the reason for this
'calculation engine' is to give the user the flexability so that I do
not need to hard code calculations for the user.
Regarding the 'calculations' available - yes it will only be predefined
as it enables parse the string and perform the relevant calculation
anyway.

To answer the other question - the user currently uses excel and has
not control over validation and how the users enter information into
the appropriate spreadsheets... so this is not really viable...

So I am still interested in reading anyone elses views...
Thanks.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6961
by: David | last post by:
Hi everyone. I have read every page that Google returns on this topic, but can't find anything that resolves my problem. Basically, I have an Access Database that does a number of different calculations. One of these calculations is rather complex, and could not be implemented properly using just nested IIF statements or anything similar, so was coded using VBA (in the VBE) as a function. This calculation is included in a query in the...
0
3117
by: Xproblem | last post by:
FTP Client Engine for C/C++ 2.4 Screenshot - Soft.comFTP Client Engine for C/C++ 2.4. ... System Requirements: Windows C/C++ compiler - Microsoft operating system: Windows 95, Windows 98, Windows ME, ... www.soft30.com/screen-70-11625.htm - 31k - Cached - Similar pages C++ Server Pages 1.6 - Soft.comC++ Server Pages (CSP) allows developers to build Dynamic Web Pages and Web ... Existing C++ projects can be ported to the Web by simply...
2
7376
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am usually stuck having to go into the database window, creating a new query, etc., and then right-clicking in a field and selecting build. Is there a shortcut key, a way to add a button to an Access toolbar, or something like that so I can use to...
1
3976
by: The_Rave | last post by:
Hi everyone, I'm trying to add my own template columns to the property builder of ..NET. E.g. a checkbox column, or an image column. But I can't find the sources of the wizard, or a way to add them to the wizard, via add-in? I tried to capture it with a macro, but all I can't get out of it is the raise event of the wizard, nothing that happens during the wizard. "
7
1749
by: Julian Jelfs | last post by:
Hi, I had an aspx pag in .Net 1.1 with a label on it. As such I had a code behind page with a declaration for that label. When I convert to Asp.Net 2.0 the code behind is converted to a partial class and the declaration for the label is removed. This is what I expected to happen and I understand why it has happened. The problem I have is that I had added a custom attribute to my label
2
3020
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text index on one column, and punctuation in the column was causing some problems down the line. This column is used only for full text indexing, and otherwise ignored. I decided to use the following regular expression to remove all punctuation (actually...
0
1097
by: kelmen | last post by:
Greeting, I'm attempting to write customize expression-builder . As to replace\enhance the build-in Resources exp-builder. It work in a way. However, somehow the resources I retrieved using GetGlobalResourceObject() always getting me the default culture. I hardcoded the culture setting at session_onstart, to test Chinese text. They all worked fine with the built-in Resources.
2
2070
by: aeden.jameson | last post by:
I have a drop-down list the I want to use to control the visibility of button fields. Here's an example of one of my button fields, <asp:ButtonField Visible='<%$ Code:ddlReason.SelectedValue = Status.Review %>' CommandName="Review" Text="Review" /> The value of ddlReason.SelectedValue within the custom expression is constant even if I select another value from the dropdown. Why does this occur?
3
1430
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
0
9589
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,...
0
10593
Oralloy
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...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
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();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
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
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.