using script to get the values of percentage and not able to sum up to 100%

Hi all

I am trying to use a parseFloat() function to convert the string value as a percentage, and then try to add all the values of %.

but for a few scenrios even if the amount is 100% of the service I get the PctValue be <>100.00%

the calculation of the function is as follows: -.

code-

{iterating_through_all_the_fields}

PctValue += parseFloat (this.getField("Percentage1").valueAsString);

}

sample-

11.12

11.11

11.11

11.11

11.11

11.11

11.11

11.11

11.11

amount is 100

but through code mentioned above I return 99.99

Any help is appreciated in this regard.

It is a result using the floating point IEEE standard and conversion from decimal to binary values values. We need to round up all the calculations of money or mils will accumulate and cause errors. For percentages, it is better to round up receipts and total final eliminate the accumulation of amounts below the figure the least significant.

It is possible to use the util.printf of rounding.

The following script will show what is happening:

function Round (nValue, nDec) {}
If (typeof nDec == "undefined") nDec = 0;
Return number (util.printf ('%, 1 0. nDec + "f", Number (nValue)));
}

var nValues = new Array (11.12 11.11 11.11, 11.11, 11.11, 11.11, 11.11, 11.11, 11.11);
nSum var = 0;
for (var i = 0; i)< nvalues.length;="" i++="" )="">
nSum = nSum + Round (nValues [i], 2);
Console.println (i + "" + nValues [i] + "" + nSum);
}
Console.println (nSum);
nSum = Round (nSum, 2);
Console.println (nSum);

Progression of the sum at each stage.
0 11,12 11.12
1 11.11 22.229999999999997
2 11.11 33.339999999999996
3 11.11 44.449999999999996
4 11.11 55.559999999999995
5 11.11 66.66999999999999
6 11.11 77.77999999999999
7 11.11 88.88999999999999
8 11.11 99.99999999999999
99.99999999999999
100

true

It's a good idea to use decimal values a percentage and leave the determination of the field format display and the borough. But for applications of the sum, the user can round up the value of the actual field and not only display.

Tags: Acrobat

Similar Questions

  • How to get the value of viewattribute and how to assign the text field. URG

    Hi all,
    I created messagestyled text programmatically and I want the value of viewAttribute.
    I don't know how to define the instance of the view and display attribute.

    I tried this way, it is what is called the vo class but after that i dnt know how to set

    Here the code that I used...

    (1) I create the messagestyled text
    OAFormattedTextBean cctextbean = (OAFormattedTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, FORMATTED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCText");

    OAMessageStyledTextBean ccidbean = (OAMessageStyledTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, MESSAGE_STYLED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCId");

    (2) and I called the view object
    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");

    (3) I want to set the view instance and viewattribute using code. This stage i dnt know how to define.

    (4) I want to know, how to get the value of the attribute to display and how to set the value to the messagestyled text field.

    I'm new to OFA. It's Urgent.

    Thanks in advance
    Fabrice

    Hello

    use
    Import oracle.jbo.Row;

    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");
    Line line (Row) = ccview.first ();
    Test String = (String) row.getAttribute ("");

    then to set the value of the text of messagestyled

    OAMessageStyledTextBean bean = (OAMessageStyledTextBean) webBean.findindexedchildrecursive ("CCId");
    bean.setText (test);

    Thank you
    Gerard

    Published by: Gauravv on August 4, 2009 09:38

  • wanted to know on how to use labview to get the values of the Spectrum Analyzer?

    Hi all

    I am a new Member and I am doing a project I have to see the performance of the DSl cable (lasting different for example 100 m, 200 m) on the Analyzer of spectrum and its values as graphic, food, BW should be get in excel sheet. I the company Rohde and Schwarz Spectrum Analyzer, I use interface GPIB 82357 B Agilent... If anyone can help me how to start. I plugged GPIB to spectrum and its drivers on the computer...

    Thanks in advance

    Patricia

    @Dennis Knutson

    I did not choose, he gave to me... and I have to work use only... no other choice...

  • Use VO to get the value of the DB and set the attribute

    Hello
    I work a page to create the new order. I need some information complete. This is my code, which works in some way not
    Public createOrder() //(String[]_args) Sub
    {
    OAViewObject vo = (OAViewObject) getxxMobileOrderVO1 ();
    If (! vo.isPreparedForExecution ())
    {
    vo.executeQuery ();
    }

    Line = vo.createRow ();
    vo.insertRow (row);

    row.setNewRowState (Row.STATUS_INITIALIZED);

    Complete support information
    xxMobileSupportVOImpl sptVo = (xxMobileSupportVOImpl) getxxMobileSupportVO1 ();
    If (sptVo is nothing)
    {
    MessageToken [] errTokens = {new MessageToken ("parameter", "xxMobileSupportVO1")};
    throw new OAException ("PER", "XXBOL_OAF_OBJECT_NOT_FOUND", errTokens);
    }

    sptVo.initSupport ();

    Line sptRow = sptVo.getCurrentRow ();

    If (sptRow! = null) {}
    row.setAttribute ("SupportPersonId", sptRow.getAttribute ("PersonId"));
    row.setAttribute ("SptName", sptRow.getAttribute ("FullName"));
    row.setAttribute ("SptEmail", sptRow.getAttribute ("EmailAddress"));
    }
    }
    The xxMobileSupportVO of VO is that a simple select statement returns a record:
    SELECT ppx.person_id
    ppx.employee_number
    ppx.full_name
    ppx.email_address
    -, lk.tag
    OF fnd_lookup_values LC
    per_people_x ppx
    WHERE lk.lookup_type = 'XXXX '.
    AND lk.lookup_code = ppx.employee_number
    AND lk.enabled_flag = 'Y '.
    AND lk. LANGUAGE = USERENV ('LANG')
    AND lk.tag =
    (SELECT MAX (NVL (tag, 0))
    OF fnd_lookup_values
    WHERE lookup_type = 'XXXX '.
    )
    AND trunc (sysdate) BETWEEN lk.start_date_active
    AND NVL (lk.end_date_active, hr_general. END_OF_TIME)
    The original Version is correctly connected to AM. I use the Test feature to make sure that it becomes value.

    However, when the page opens and createOrder method is called. The field gets no value populated.

    Anyone can tell what is the problem?
    Thanks in advance.
    Rudolph

    You run the query of the VO?

    I guess you're running it in sptVo.initSupport ();

    Otherwise, first run the VO by using sptVo.executeQuery)

    After executing the query, do sptVO.first ().

    This will give the line of the VO.

    Then do your work on this basis.

    Kind regards

    Stephanie.

  • Police found during the opening of file and not able to solve, but drop-down list fonts?

    Hi, I just downloaded some files from a friend and he sent me a link to download the fonts. I have done so and 98% of the book of fonts, but there are two fonts, with that I fight.

    When I open the file I get the police lack of attention and it asks me to set the fonts. I can't find the police appropriate in the drop-down list if I click "solve" and begin editing the file. Then I met a text which lack of fonts and I'm able to highlight text and change the text for the police appropriate using the text tool and the font you are looking for is in the drop-down list.

    The fonts that are not working are:

    Franchise "BOLD" and BebasNeue

    The problem is there are several separate incidents where occur these fonts, and passing through each change manually would take a lot of time.

    Is there something I can do to fix all at once?


    Thank you

    Harry

    d9c317be81edbaf79cf4e5225a6f2ca8.png83f707320ba36bdec7b840e37c302791.png

    I don't see the two fonts in the list that show you.  I see Bebas Neue xxx but no Bebas Neue without any additional style. Try Bebas Neue Download Bebas Neue police - thousands of fonts for free download

  • Need a script to get the values of hide/show

    Hello

    I use Adobe Acrobat 8. I have two radio buttons with perhaps 70 hide/show actions. Unfortunately, when I have to change one of them I have to search through all the actions. Y at - it a script that can give me a .txt file or another way to give me a list of all values?

    Thank you

    Tom

    This can be done with a script, because it has no access to this

    information. It should be a stand-alone tool or plugin.

    On Tuesday, December 23, 2014 19:48, Tom Tomasko [email protected]>

  • ASD service - how to get the values of Description and reason in the workflow

    Hi all

    I've created a workflow-based service of ASD. When the catalog of the ASD is requested, the first tab is 'Request information' which has the field description and reason. How to access these values to the underlying stream.

    Thank you

    Hello

    Here's a simple solution:

    ASDRequestId = System.getContext () .getParameter ("__asd_catalogRequestId");

    ASDRequest = vCACCAFEEntitiesFinder.getCatalogItemRequest(vRA_CAFEHost,ASDRequestId);

    Request_Reason = ASDRequest.reasons;

    Request_Description = ASDRequest.description;

    Request_Owner = ASDRequest.requestedFor;

  • I chose a character, but when I start Firefox, Mozilla start page with Google, and persona shows is only barely visible in the toolbar area. How can I get the persona of show and not Google start page?

    I checked the Personas of Mozilla, has seen one I liked and added the. When I start Firefox, the Mozilla start page shows as usual with Google on this subject. The character I chose shows barely and only in the area of the toolbars at the top of the screen. Can I change the start page to not display Google and access Google another average, so that my character is displayed on the start page of together?

    This has happened

    Each time Firefox opened

    == I added on Persona

    As you can see on the article using themes with Firefox , personas are 'lightweight themes that can change the color plan and the Firefox toolbar background image' and they do not change Web pages.
    If you do not see Google as home page you can watch How to set the home page and change it.
    Finally Firefox 3.5.x will be maintained with security and stability updates until August 2010, so you may want to update to a newer version.

  • Is it possible to get the value of the resistance of a circuit with NI USB-4065 USB without using studio measure?

    Hi, I'm working on a project where there partly to measure resistance values in different parts of the circuit. Now, the company where I work currently at wants to get the NI USB-4065 USB. I use visual studio 2005 c# to develop applications and I need to know if I needed measurement studio or are there drivers (dll) just to get the values of resistance and General measures of circuit. I have need the controls or anything, just to programatically read the NI USB-4065 USB key values when I need the application.

    Any help would be appreciated. Thank you.

    Yes, you can have several NI 4065 DMM in your system. When you use the API OR-DMM, you open the handles separately for each DMM by using its name. His name can be configured inside the measurement and Automation Explorer (MAX).

    In addition, you can go ahead and install OR DMM today. It is downloadable for free on ni.com. NOR-DMM (and most of the pilots NOR) supports the simulation. You go to MAX and create your simulated three 4065 s. Then you can start writing your program now. Since these devices are simulated, they will not return the real tensions (obviously) and that it won't react realistic hardware triggers if you use (obviously), but they are pretty close to the real deal to allow you to write a lot of code and become familiar with the API. No need to wait until you get the material - you can be really ready for it by using the simulation.

  • How to get the value of the global element using javascript or ajax!

    Hello!

    How can I read at global(point application created in the shared components) using ajax or javascript?
    You can imagine that I need to get the value of this element by function as:
    -----
    Function getText() {var itemVal = $x ('MY_GLOBAL_ITEM') .value;}  Return itemVal; }
    -----
    .. .but I can't do it because it is not made to couse of the page it is global element! so, anyone know no work around to do?
    I know that I can make point page and read the value of that, but not what I really need!
    If I have 100 pages and all pages need to use my function, it would take 100 Articles :) - that's why its no good average!

    Please, share your ideas!

    THX

    Rafix,

    You must use a little AJAX to retrieve a request element value. Three steps in this solution. Implementation of a callable JavaScript function, creating an application process on the request and call the JavaScript function with dynamic action.

    1 set up a JavaScript function that can be called by:

    This function calls the process of application level which has a visibility of the element of your application and then returns the value of points.

    Edit your page and JavaScript code according to the code in the 'function and Variable global statement' of your page. You can also add to the model page, that you use, but you also have to encapsulate this code in the script tags.

    getAppItem = function(pItemName){
        var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=GET_APP_ITEM',$v('pStepId'));
        get.addParam('x01',pItemName);
        gReturn = get.get();
        get = null;
        return gReturn;
    }
    

    2. creating an application on request process:

    The application of level process has visibility to your application-level element. It is to retrieve the value of points and it prints the htp buffer. Essentially, this acts as a way to return the values of AJAX calls (the javascript function we set previously);

    go to the shared components > procedures > Create.

    Point process: "We Demand: run this application...". »
    Name: GET_APP_ITEM
    Type: Anonymous PL/SQL block

    declare
       -- get the item name passed into the JavaScript function.
       app_item_name varchar2(30) := apex_application.g_x01;
    begin
        -- print its value to the buffer
        htp.p(v(app_item_name));
    end;
    

    3. call the JavaScript function with dynamic action:

    The function call allows to specify an application-level element name and have its returned value. The trigger event is specific to what you need, but the action must be of type to run JavaScript code. In my case immediately the value of P1_NUMBER to my value of demand points. This code doesn't have to be in a dynamic action, but it helps to stay organized. you could call it from any script tag.

    $s('P1_NUMBER',getAppItem('MY_APP_ITEM'));
    

    See you soon,.
    Janet Tyson

  • Using the calculation script to write the value of the variable Substitution in a file

    Hello

    I am trying to use the calculation script to write the value of Substitution variable in a text file.
    I use the dataexport command. But it is not able to write values in the text file.

    Any help is appreciated.

    Thank you.

    MaxL would display variable. See: http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_techref/maxl/ddl/statements/dispvarb.htm

    BTW, I mostly prefer Esscmd MaxL. I think that makes me a heretic, but I don't understand why I don't want to type more rather than less to get the same result.

    Running a calc:
    Esscmd - RUNCALC 2 calcname
    MaxL - run calculation Sample.Basic.calcname;

    To be fair, Esscmd requires a dbname appname SELECT before the RUNACALC, but it is always less striking.

    However, time is running, so I don't have too. And of course, MaxL now has many things that Esscmd doesn't like Esscmd is obsolete.

    I always use Esscmd to run scripts of calc I can actually watch the output in real time as opposed to MaxL that exports the console at the end of execution.

    Kind regards

    Cameron Lackpour

  • Is it possible to use the batch is script to retrieve the value window server political group?

    Y at - it a batch command that will allow me to recover the value of group policy in Windows server? Something like gpedit.msc did, but I want because of the command line I want to convert this value to format I want.

    Example: If I open gpedit.msc, then I go to Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\Restore files and directories so I can get the value (administrators, backup operators) of this policy.

    All ways in the batch script can bring me to this path and capture value?

    Thanks, your help is very appreciated.

    Hello

    You could try to look at the list of Group Policy scripts or repost the question to the Scripting Guys or in Forum Windows Server forum.

    The guys from script

    Windows Server

  • Cannot get the value of the session variable (using row wise initialization).

    Hi all

    I have a scenario where I'm trying to get the value of the variable session of two columns.

    Table of database consists of the name of USER, Country_Region, columns Country_SubRegion.

    For example: ChadraKanth, Americas, America West is the data.

    I wrote a Sql query in the block of session initialization:

    Select "CR", Country_Region, Country_SubRegion

    of row_wise_init

    where USERID = ": the USER"

    When I test the RPD code gives the result like this:

    CR WesternAmerica of Americas.

    In my report I have two columns, a region and an another subregion.

    When I try to filter with the session variable "CR" for the column region his error giving: session variable is not initialized with

    This is the default.

    Question:

    1. session variable is contains several values in the column?

    2. how to filter the report on columns of region and sub region?

    Please suggest me.

    Kind regards

    Chandra Khalil.

    Hello

    A session variable cannot store more than one column, 1 variable = 1 value (column 1), horizontal initialization allows to store several lines, multiple values in the same variable.

    If to a user, you have several lines with multiple values, you need horizontal initialization, but it cannot store in the variable the value of the region and subregion.

  • How to get the values of the table of the ADF to bean class?

    Hi all

    My 11.1.1.6 Jdev

    Here I do not use BC ADF in my project.  I'll put values in the ADF table with bean.

    In the table, I put a checkbox. When I selected (Checkbox) a few rows in table and submit. In the submit method, I want to get all the values of line checkbox selected in my bean class.

    How can I get the values. ???

    Here my table UI code

    < af:table var = "row" rowBandingInterval = "0" id = "t1" value = "#{pageFlowScope.BinderSolutionsBean.uiBinderProperties} '"

    styleClass = "AFStretchWidth" emptyText = "no record found".

    Binding = "#{pageFlowScope.BinderSolutionsBean.binderTree}" >

    < af:column sortable = "false" headerText = "Script ID" id = 'c4' >

    < af:panelGroupLayout id = "pgl4" >

    < af:selectBooleanCheckbox id = 'sbc1' > < / af:selectBooleanCheckbox >

    < af:spacer width = "5" / >

    < af:outputText value = "#{row.scenarioId}" id = "ot5" / > "

    < / af:panelGroupLayout >

    < / af:column >

    < af:column sortable = "false" headerText = "Quote ID" id = "c1" >

    < af:outputText value = "#{row.quoteId}" id = "ot4" / > "

    < / af:column >

    < af:column sortable = "false" headerText = "NASP ID" id = "c2" >

    < af:outputText value = "#{row.naspId}" id = "ot2" / > "

    < / af:column >

    < af:column sortable = "false" headerText = "GCH ID" id = 'c3' >

    < af:outputText value = "#{row.gchId}" id = "ot3" / > "

    < / af:column >

    < af:column id = "c6" headerText = "Term" >

    < af:outputText value = "#{row.term}" id = "ot9" / > "

    < / af:column >

    < af:column sortable = "false" headerText = "Status" id = "c5" >

    < af:outputText value = "#{row.status}" id = "ot6" / > "

    < / af:column >

    < / af:table >

    follow some above recommendation such as the creation of additional attribute. You will also need the key in your collection, while making the data for your chart.

    You must write a custom selectionListener. On valueChangeEvent of box, get the key of a line and add the line at the bean.

    Maybe it's little help for you

    https://tompeez.WordPress.com/2012/01/22/jdev-custom-SelectionListener-for-viewobjects-in-rangepaging-mode/

    How to get the selected row in a table no-bind ADF

  • Need help with Javascript to get the value of standard report column

    Hi all

    Apex 3.1 version

    I have a query SQL (editable report) region where I need to do validations using a process of OnDemand and javascript. For this posting, I need to use the serial number and id of this same report line item. The function is called when the serial number is changed. I can get the serial number easily because it is a text field, however, the item id is a standard report column (which actually a text field or hidden gives me a checksum error, long story). How can I get the value of the standard report column to set the value of an element of the Application to use in my process of application as well as the serial number? Here is my code below.
    <script>
    
    function f_ValidateSerial(pThis)
    {
        
      // The row in the table
    
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
        //alert('Row is '+vRow);
    
    
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    
      
     var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
     get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
     get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
     
     gReturn = get.get();
     
    if (gReturn)
        { 
          alert(gReturn);
        }
     
      if(gReturn)
        { 
          html_GetElement('f21_'+vRow).value = '';
        }
               
    }
    </script>

    Hello

    Ok

    Item ID is standard report column.
    If you enter this Expression HTML column

    #ITEM_ID#
    

    I guess that the substitution of column item Id is #ITEM_ID #.

    Now, you have hidden input form that is not submitted.
    Then in JavaScript

    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement('item_id_'+Number(vRow)).value);
    

    Kind regards
    Jari

Maybe you are looking for