- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.6K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 115 Navision DOS
- 854 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 615 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 298 Dynamics CRM
- 109 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 993 SQL General
- 384 SQL Performance
- 34 SQL Tips & Tricks
- 34 Design Patterns (General & Best Practices)
- Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.7K General
- 1.1K General Chat
- 1.6K Website
- 79 Testing
- 1.2K Download section
- 23 How Tos section
- 259 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

chandrurec
Member Posts: **560**

Hi all,

Actually I want to add a field named calculation formula which is text field in Production BOM line table.For example the formula includes 2 fields named height,width.Based on the formula given in Calculation formula, I need to calculate and populate it in a new field.

Is it possible to compute dynamically based on the calculation formula given by the user?

Thanks in advance.

Regards,

chandru.

Actually I want to add a field named calculation formula which is text field in Production BOM line table.For example the formula includes 2 fields named height,width.Based on the formula given in Calculation formula, I need to calculate and populate it in a new field.

Is it possible to compute dynamically based on the calculation formula given by the user?

Thanks in advance.

Regards,

chandru.

0

## Comments

2,973Refer to formula calculation in Account Schedule, Structure, Excise Duty elements calculation .........

http://ssdynamics.co.in

5,479You are kidding right? Did you actually even try? #-o

Just go to any decimal field and type 4x5+3

David Singleton2,973Text Box 1 (field name "Height")

Text Box 2 (Field name "Length")

Text Box 3 formula entered by user (x+y)*x/y where x = Textbox 1 and y = textbox2.

http://ssdynamics.co.in

77560I tried your method but the CalcFormula is a text field and this field contains something like (width*height)/100 where width and height are 2 fields.

CREATE(scriptControl);

scriptControl.Language:='vbscript';

MESSAGE('%1',FORMAT(scriptControl.Eval(CalcFormula)));

I have used like this.I am passing the CalcFormula in the Eval parameter but I am not getting the output.

If you have any idea on this,kindly let me know.

Thanks & Regards,

chandru.

77560I have created a test form for testing. In this form I have created 3 variables.

Name DataType Subtype Length

CalcFormula Text 250

Width Decimal

Depth Decimal

The above is the variables created.

I have created a command button and in the on push trigger ,I have given the following code.

CREATE(scriptControl);

scriptControl.Language:='vbscript';

MESSAGE('%1',FORMAT(scriptControl.Eval(CalcFormula)));

When the user run the form, he need to give values for width,depth and enter the calculationformula and based on this automatically when the user clicks the calculate button based on the formula entered by the user ,it should dynamically calculate.Now if i run the form, and click on Calculate , its showing 0.

can u help me on this?

Thanks & Regards,

chandru

77560In the previous code snippet, you r hardcoing the formula.But I want the formula to get computed dynamic based on what value I give in the CalcFormula text field.

I mean i will be getting three input from the user.

One is for Width,Depth and calcformla.And in calcformula, the user can give any formula based on 2 fields width and depth.

For Ex:

1.width*depth

2.Width*Depth/100

3.(Width*100)/depth

Thanks & regards,

chandru.

3,633ssinglaalready pointed out, you should look at the functionality which is offered by the Accound Schedules (Financial Management -> Analysis & Reporting). When you setup Column Layouts, you can define your own formula's.1,023math operatorswidthmath operatorsheightmath operatorsand replace it with

math operatorsrec.width.valuemath operatorsrec.width.valuemath operatorsthen evaluate the parsed calcformula and pass it to either the parser for formula's in NAV or the scriptcontrol?

That is the requirement i see.

But step one (replacing the keyword width and height with the actual values) is never been done. (As far as I can see).

so first prepare your statement before you parse it.

|Pressing F1 is so much faster than opening your browser||To-Increase|560I converted the text into value using string functions and then passed the text variable in eval function. Now I am getting the output.

Thanks & Regards,

Chandru.