To control the decimal point in real value AX2012 - axapta

"
To control the decimal point in real value do the following :
1- right click on the real field and choose properties
2- go to NoOfDecimals property and put any number you want for example (1 or 2 or 3)
This means the numbers after the decimal point example :
if the value is 2.31689
if you put 1 the result is 2.3
if you put 2 the result is 2.31
"
from https://community.dynamics.com/ax/b/msdynamicsaxbyabdelfattahahmed/posts/how-to-control-the-decimal-point-in-real-values-in-ax
how can i do this in code for 5 ?

Related

roundoff value to decimal 2 place with floor value

I am looking for help from XQuery experts where I need to round off values of a variable to 2 decimal places along with floor value like below.
say I am getting a variable value like 750.006 - value should be upto 2 decimal place. I am able to achieve that with help of below query.
fn-bea:format-number((xs:decimal($InputValue)),'0.00')
Now the issue is, I would like to have 3rd decimal digit to a floor value like say if
if the value is coming as 750.006 , it should be rounded to 750.01 (upto 2 decimal place)
if value is like 750.004 , it should be 750.00
could someone please help me on this.
You can use fn-bea:decimal-round($value, $scale) to round the value before formatting it:
fn-bea:format-number(fn-bea:decimal-round(xs:decimal($InputValue), 2),'0.00')

Drupal Webform : set SCORE on each SELECT Options?

I have webforms on drupal with multiple select options (radio).
And in my select, I want to say option 1 : gives 2 points, option 2 : give 1 point, etc... For after display on a webpage : your score is 12/20 points.
example :
A bear can be ... ?
0|White <- response give 2 points
1|Yellow <- response give 0 point
2|Brown <- response give 2 points
3|Dark <- response give 1 points
The question is : how to store the point of select options because there is only key|value in the admin interface?
In fact : how to add infos each select option row?
The way to do this would be to associate key with points. Thus 0 corresponds to 2 points, 1 to 0 point, 2 to 2 points and 3 to 1 point.
Thus on submission you would look at user responses and then calculate based on the responses to those particular question.
Thus under form settings would set the redirection location to a page where you process this logic and then redirect from there or show the output on the same page.
Finally, that I do :
I fill the option list with :
key_score|description
And i use explode function with _ seprator.

Is dBase file according to specifications

Please consider a DBF file with a field N(7,3). Is it allowed to store 9999.99 in such a field? In my mind 999.999 is the largest number allowed and -99.999 is the smallest.
You are correct on your 999.999. The full amount allows for 3 whole digits (or - plus 2 digits) decimal for 4th position and 3 more actual decimal.

Always display two digits after decimal separator navision

I'm using Microsoft Navision 2009. I'm creating report that includes several number with decimal separator (double/float number in C#).
I'm stuck at the point where I want to display every number with two digits after decimal point.
Ex:
if number is 100, I want to display 100.00
if number is 100.5, I want to display 100.50
if number is 100.55, I want to display 100.55
if number is 100.505; i want to display either 100.51 or 100.50
Thank you in advance;
Language that I'm using is C/AL
Don't be lazy. Read essential manuals. Format function is your best friend in Nav.
strsubstno(text01,format(100.10,0,'<Precision,2:2><Standard Format,0>'))
Third argument of Format is actually the format of result text. <Precision,2:3> means that if first argument is decimal it will have from 2 to 3 (minimum 2 and maximum 3) digits in decimal part. <Standard Format,0> means that the rest of format will be standard.
More here!

Best way to implement a read and write for an unknown amount of rows

I asked a question similarly, but the outcome was pretty messy and I was having difficulties populating so I'm trying to go at from a different angle:
Question concerning asp:listview and multiple dynamically created controls
I have a table which stores steps in a process. Some companies only have 6 steps while others have 15, so I created a table with 15 different slots for steps. What I would like to do is set up a control that displays each step in its own row with a label next to it saying "Step '#'", and not in an adjacent column. I'd also like for it to not display any blank rows. If they are entering the step instructions, I would want for them to have to press a button that would add a row so that they aren't just given 15 empty text boxes to fill in.
What would be the best control to do this in, and how would I get started in setting it up?
You are putting data in the field names in the table, which makes your task more complicated. Instead of storing the steps in columns, like this:
CompanyId Step1 Step2 Step3 Step4 Step5 Step 6 Step7 ...
1 alpha beta gamma
2 one two three four five
You should store the steps as rows, so that you get the step number as data in a field:
CompanyId StepNumber Step
1 1 alpha
1 2 beta
1 3 gamma
2 1 one
2 2 two
2 3 three
2 4 four
2 5 five
This way you don't get any unused fields, and the data model doesn't pose any limitation on the number of steps. Also, you can easily get the steps as a collection instead of having to get each one separately and add to a collection.
Something like:
var steps =
from s in CompanySteps
where s.CompanyId = 2
orderby s.StepNumber
select new { s.StepNumber, s.Step };
Then you have many different options to display the steps, like using the collection as data source in a Repeater, or loop through the items and just create HTML code for them and put in a Literal control.

Resources