Round the percentage to a whole number

Hello

I'm still pretty new to perform calculations of script and thereby an individual seems a bit more complex for me.

I am trying to determine the difference in percentage between 2 numbers and display the percentage as a whole number. Logically my calculation looks like

(numericField1 - numericField2 / numericField1 * 100)
(e.g. 1000-850 / 1000 * 100 = 15%)

I need help with my math and especially round the % to an integer. I wouldn't have all of the answers posted as 22.66666%

The code below is somethig I tried

Event.Value = roundNumber ((this.getField (numericField1) .value - this.getField ("numericField2t") .value) / this.getField (numericField1) .value, 2) + "%";

function roundNumber (num, dec) {}
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec;)
return the result;

Any advice would be great!

Adobe is actually this really simple for you.  If you use a numeric field to display the result, the display for the field template will control the way number.  You can set a percentage pattern:"num{zzzz9.99%}" to control how many digits will be displayed, and how many digits will be important beyond the decimal point.  If there is more than numbers, Adobe will automatically complement number.  In the attached example, I used the boss

"{zzzz9 %} num" to ensure that only a whole number will be displayed.  Adobe uses the normal rounding rules: 0-4 rounds down, 5 to 9 rounds.

In addition, the percentage will automatically multiply the value in the field by 100, so you don't need to do it in your script.

For the attached example, I added your script FormCalc calculation to Calculate the result field event.  The script is now simply:

(NumericField1 - NumericField2) / NumericField1

Adobe takes care of the rest.

Tags: Adobe LiveCycle

Similar Questions

  • Rounded to the nearest whole number text size?

    I had to resize a work of art, but now I find myself with sizes that are 71.68px up, 34.51px up, etc.

    Y at - it a script that will break all the text in a document that it is the closest number integer or decimal 0.1?

    // rounds the size of text in all textFrames in your document
    var aTFrame = app.activeDocument.textFrames;
    
    for ( i = 0; i < aTFrame.length; i++ )
    {
    var fractionSize = aTFrame[i].textRange.characterAttributes.size;
    var RoundedSize = Math.round(fractionSize);
    aTFrame[i].textRange.characterAttributes.size = RoundedSize;
    }
    redraw();
    

    This will make all the text frames. Copy the above, paste it into a text editor or the Adobe ESTK (ExtendScript Toolkit) and save it in a text file with the .jsx extension. Place it in the folder/Applications/Adobe Illustrator CSX / Presets / en_US / Scripts and restart HAVE. Run it by the presence of a document in artificial intelligence and call it from file > Scripts > scriptname.

  • What settings can I change my captivate program so that when a user does the program into an LMS they are marked as being completed when they hit a specific slide (not a number of slides) or the percentage of slides

    What settings can I change my captivate program so that when a user does the program into an LMS they are marked as being completed when they hit a specific slide (not a number of slides) or the percentage of slides

    I have duplicate slides that the user can jump. When they do the program is marked as progress when really, they have seen everything but technically not each slide.

    I wish that the LMS to makr as complete when they consult the last slide so that they are marked as being completed independently to know if they jumped the previous slides.

    Thank you. In fact, I managed to find a solution that does not require the user to press the button! You can add an action to a slide itself using Javascript execution on success. In the Script window, you add that scorm_setcompleted() and that tell of the SGA to mark the complete project on enter on this slide. So that's what to do if someone reads this

  • How to include the total number of table one fact in another fact table to calculate the percentage

    I have a fact table in the grain of each document created in any organization, say the 1st table of facts. I have another table of facts (2nd fact table) seen those documents which are considered by different commentators. grain of this second fact table is so each review, even if I document in both IDs the fact table.

    Now, I want to calculate the percentage return documents reviewed. For this I need to divide count separate from the document of performance by the total performance document. Now this document of total performance can be obtained from the 1st table of facts, but I don't get how to bring this indictment in the 2nd table of facts to show the percentage.

    Please let me know if there is no ambiguity in my question, because I'm a starter in OBIEE.

    Thank you very much.

    then you can set new logical column with two columns of fact in the formula

  • What forms can I use numbers on mac to show the percentage of participation of members of my team in daily activities?

    I am in charge of the follow-up of the participation of the members of a strong team of 50 to a daily activity and have set up a spreadsheet of numbers for this purpose. Members of the team can participate or not, and I would understand a single cell that shows the product of the number of times that the person participated against the number of days that they have been a member of the team. For example, if a member of the team is involved every day while they are a member of the team, their percentage will be 100%. If someone else participates only 9 times over 10 days that they are members, their percentage bed 90%

    Does anyone know what forms to use in figures? If it isn't cooked loan formulas, is there a formula I can type in long-hand?

    Thanks in advance.

    Hi jm,

    daysparticipated/totaldays

    Percent format.

    Total number of days (12) is in B1.

    Each total of people is in the B column, next to its name.

    Formula C2:

    = B2÷B$ 1

    Fill down the rest of the C column.

    Format cell in column C to display the percentage. Set the number of places after the decimal point as see fit you.

    Kind regards

    Barry

  • How to test if the rest is a decimal number or an integer?

    Hi guys!

    I want to check whether or not my rest of two integers is a decimal number. Also, if it is a decimal number, I wana it allows to do a thing and if its an integer, I want her to do something else. How can I do?

    Help, please!

    Thanks in advance.

    Craster.D wrote:

    The task is to divide two numbers X and Y and a LED lights up if the result/rest is a decimal number. It can be higher or lower than 1, is not serious. If it is not a whole number, the LED should light.

    Great looks that you know exactly what you want to do, which seems to be the problem?  You will find the functions you need in the digital, boolean and comparison scheme.

  • Management when the percentage getting null values

    Hi all

    I'm writing a query that gives me the account, the total number of transactions, the total number of transactions that are being matched (from the same table) and finally a percentage.

    After the documentation and brushing my knowledge of sql, this is the query.

    Select A.ACCOUNT_ID,A.TOTAL_TXN,B.TOTAL_MATCHED,(B.TOTAL_MATCHED/A.TOTAL_TXN) * 100 AS PERCENTAGE

    FROM (select account_id, count (*) bdr_transaction TOTAL_TXN

    where

    value_date = January 9, 15 '

    Account_id group) has

    LEFT JOIN

    (select account_id, count (*) bdr_transaction TOTAL_MATCHED where)

    value_date = January 9, 15 ' and

    type in (1,2)

    Account_id group) B

    ON A.ACCOUNT_ID = B.ACCOUNT_ID;

    This query gives me almost the expected output (if it takes too much time), but when the result of the B.TOTAL_MATCHED column is null the percentage is also set to null.

    Is there a way or a workaround to handle this?

    There might be another way more quick/clean, to do so.

    Thank you

    TK

    Select ACCOUNT_ID, TOTAL_TXN, TOTAL_MATCHED, (TOTAL_MATCHED / TOTAL_TXN) * 100 AS PERCENTAGE

    de)

    Select ACCOUNT_ID, count (case when type (1, 2) then 1 end) TOTAL_MATCHED, count (*) TOTAL_TXN

    of BDR_TRANSACTION

    where VALUE_DATE = January 9, 15 '

    ACCOUNT_ID group

    )

  • Question form: How to get the percentage calculated?

    Hello!

    I have a form that is a Bill as form. I can't get the front total tax, then plug the percentage tax amount (it varies depending on the County, so it cannot be a static number), then adding total before tax plus taxes. HOWEVER, I also need to know what total percentage tax is in the form of $.

    For example:

    BOX A - Total before taxes: $10.00 (calculated by the form of the total above form)

    BOX B - percentage of the tax: 10% (filled by the user)

    BOX C - Total AMOUNT: $ 11.00 (calculated from above)

    What I need too, is:

    BOX - total tax: $1

    Its final form:

    BOX A - Total before taxes: $10.00

    BOX B - percentage of the tax: 10%

    BOX C - total taxes: $1

    AREA D - Total AMOUNT: $ 11.00

    Thank you!

    Is box B a real percentage field, or is it just a body of numbers?

    If the first case, as the custom calculation of box C script enter:

    Event.Value = number (this.getField("Box_A").value) * number (this.getField("Box_B").value).

    If it's the latter, then copy the following code:

    Event.Value = number (this.getField("Box_A").value) * (number (this.getField("Box_B").value) / 100);

    Then set the calculation of the D box as being the sum of area A and area C.

  • problem with the help of the conditional formatting on a cell that is defined as the percentage

    Hi all

    I am facing a problem with the help of the conditional formatting on a cell that is defined as the percentage.

    I am using beaches for example:

    is equal to or greater than 10% - green color

    5%-10%-yellow

    less than or equal to 5%-color red


    the problem is that keeps the value 10% get yellow color when it should get green.


    i thought that is a rounding issue but when I change the definitions of the cell to learn more decimal places I see this part of the percentage 9.65% and some of them are 10.00% and they are both colored in yellow.

    I also tried to change the way range of 6 to 9%, but values between 9.65% or 5.5% are not colored.


    I really enjoy your help!

    You know the reason and the solution.

    change the format of the column and go or add a column more with decimal and opt for conditional and hide report.

    Thank you

    http://cool-bi.com

  • Need a Script to the space of images on a total gap, then tag each image with the percentage of the total image space

    By editing the other scripts, I found here and other sites (including the labels size rorohiko), I worked on a script that will each image with the dimensions of the label and calculate the percentage of the spread of everything (including the text, white space).

    Now, I was invited to a script that tagged the images with the percentage of total image on a gap space. This script is so space images on a total gap, then tag each image with the percentage of the total image space. For example if there is an image that is 10 x 10 inches and four pictures that are images of 2.5x2.5, 10 x 10 would be tagged with 50% and the 2.5x2.5 would be tagged with 12.5%.

    This is the script that does the percentage of total circulation. Can some clever person get to do what I need?

    Suze

    (Sorry, I don't know how to post the script here with line numbers!)

    //

    This script adds printing of information labels to each graphic image. The labels are on a separate layer

    named "PercentageLabels" so that all these added labels can be removed again by simply removing

    the layer.

    //

    If you move or resize items, simply re-run the script to update the labels.

    //

    Before (re) start the script, you can define a paragraph style "SizeLabelStyle".

    This style will apply to all content on labels.

    //

    Before (re) start the script, you can set a style of object 'SizeLabelObjectStyle '.

    This style of object apply to all executives of the label - so if you want a specific background

    fill out or frame, do it through this object style.

    //

    You can change the units of the size label. I put in inches. Change the line below that has

    kUnitToUse - you can use:

    MeasurementUnits.CENTIMETERS

    MeasurementUnits.CICERO

    MeasurementUnits.INCHES

    MeasurementUnits.MILLIMETERS

    MeasurementUnits.PICAS

    MeasurementUnits.PIXELS

    MeasurementUnits.POINTS

    //

    By default the script will not attempt to label the "nested" images If you also want to label

    nested images (for example inline images, anchored frames, pasted images in the images,...) to change the line

    below to read:

    kLabelNestedItems = 1

    //

    If you want a specific image to stay without a label, you can use the Script label palette for

    assign a script called 'ignore' for this frame. The script will then not label this framework to the

    the title of the script is removed again.

    //

    Change the lines with kDontLabelImageFrames, kDontLabelTextFrames, kDontLabelOtherFrames

    below if you want to restrict labelling to only certain types of images: replace the '0'

    in "1" to enable these options.

    //

    Change the line with kShowImageFileName if you also want to display the names of the image in the

    size for the picture frames.

    //

    Small frames are not labelled - the cutoff point is currently a less than 0.1 inch high framework

    or 0.1 inch wide. You can change the cutoff point by adjusting the lines with kDontLabelBelowWidth

    or kDontLabelBelowHeight below.

    //

    var Girard;

    var gScriptFile;

    var gCaches;

    // ****************

    That's cheating spread automatically calculated

    var doc = app.activeDocument;

    doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;

    doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;

    PageWidth = doc.documentPreferences.pageWidth var;

    stucture var pagewidth = * 2;

    var spreadheight = doc.documentPreferences.pageHeight;

    var spreadsquinch = stucture * spreadheight;

    Alert ("the total measure of square inch of spread is:" + spreadsquinch);

    //******************

    VR;

    {

    If (app.activeScript instanceof file)

    {

    var gScriptFile = app.activeScript;

    }

    }

    catch (Girard)

    {

    }

    If (typeof (kLogLevel) is "undefined")

    {

    const kLogLevel = 5;

    const kMaxLogNestLevel = 5;

    const kLogToMessageBox = 0;

    const kLogToConsole = 0;

    const kLogToFile = 0;

    const kLogFileName = "PercentageLabels.log";

    const kIgnoreFrameLabel = "ignore."

    const kSizeLabelLayerName = "PercentageLabels";

    const kLabelNestedItems = 0;

    const kDontLabelImageFrames = 0;

    const kDontLabelTextFrames = 1;

    const kDontLabelOtherFrames = 0;

    const kUnitToUse = MeasurementUnits.INCHES;

    const kShowImageFileName = 0; This set to 1 to precede the name of the image file in the tag

    Below all of the measures are expressed in kUnitToUse (e.g. inches if MeasurementUnits.INCHES is used)

    const kRoundToDecimals = 2;

    The separator to use between objects - for example MyImage.jpg - 7.22 x 9,34

    const kSeparatorBetweenNameAndSize = "-";

    const kSeparatorBetweenHeightAndWidth = "H x"; "

    const kSeparatorAfterWidth = "W";

    const kDontLabelBelowWidth = 0.1; In kUnitToUse

    const kDontLabelBelowHeight = 0.1; In kUnitToUse

    const kLabelStyleName = "SizeLabelStyle";

    const kLabelObjectStyleName = "SizeLabelObjectStyle";

    const kLabelHeight = 0.6; In kUnitToUse

    const kLabelWidth = 2.5; Expressed in kUnitToUse (e.g., inches).

    }

    var gRunState =

    {

    logToMessageBox: kLogToMessageBox,

    logToConsole: kLogToConsole,.

    logToFile: kLogToFile,.

    functionNestLevel: 0,

    logFunctionEntry: true,

    logFunctionExit: true,

    logLevel: kLogLevel,.

    logFileName: kLogFileName

    };

    Main();

    // ****************

    function ConvertToFrame (thePageItem)

    {

    / * / / / LogEntry ("ConvertToFrame");

    var retVal = thePageItem.getElements () [0];

    / * / / / LogExit ("ConvertToFrame");

    Return retVal;

    }

    // ****************

    function CollectionToArray (theCollection)

    {

    / * / / / LogEntry ("CollectionToArray");

    var retVal = theCollection.everyItem () .getElements () .slice (0);

    / * / / / LogExit ("CollectionToArray");

    Return retVal;

    }

    // ****************

    function GetImageFile (pageItem)

    {

    / * / / / LogEntry ("GetImageFile");

    var imageFile = null;

    do

    {

    Try

    {

    pageItem = ConvertToFrame (pageItem);

    If (!) (("allGraphics" in pageItem))

    {

    break;

    }

    var allGraphics = pageItem.allGraphics.slice (0);

    If (allGraphics.length == 0)

    {

    break;

    }

    var chart = allGraphics [0];

    var graphic.itemLink = link;

    imageFile = new File (link.filePath);

    }

    catch (Girard)

    {

    }

    }

    While (false);

    / * / / / LogExit ("GetImageFile");

    return imageFile.

    }

    // ****************

    function GetImageName (pageItem)

    {

    / * / / / LogEntry ("GetImageName");

    var imageName = "";

    do

    {

    var imageFile = GetImageFile (pageItem);

    If (imageFile is nothing)

    {

    break;

    }

    imageName = imageFile.displayName;

    }

    While (false);

    / * / / / LogExit ("GetImageName");

    return imageName;

    }

    // ****************

    function GetOuterPageItem (pageItem)

    {

    / * / / / LogEntry ("GetOuterPageItem");

    var retVal = null;

    do

    {

    Try

    {

    retVal = pageItem.parent;

    If (retVal instanceof spread | retVal instanceof Page)

    {

    retVal = pageItem;

    break;

    }

    If (retVal instanceof character)

    {

    retVal = GetOuterPageItem(retVal.parentTextFrames[0]);

    break;

    }

    }

    catch (Girard)

    {

    retVal = null;

    }

    }

    While (false);

    / * / / / LogExit ("GetOuterPageItem");

    Return retVal;

    }

    // ****************

    function LogMessage (message, collapseLines)

    {

    If (gRunState.logToConsole)

    {

    $.writeln (message);

    }

    If (gRunState.logToFile)

    {

    var logFile = new file (gScriptFile.parent + "/" + gRunState.logFileName);

    var now = new Date();

    logFile.open ("a");

    logFile.write (now.toString () + ":"+ message + "\n" ');

    logFile.close ();

    }

    If (gRunState.logToMessageBox)

    {

    Alert (message);

    }

    }

    // ****************

    LogEntry (message) function

    {

    If (gRunState.logFunctionEntry)

    {

    If (gRunState.functionNestLevel < kMaxLogNestLevel) {}

    for (var idx = 0; idx < gRunState.functionNestLevel; idx ++)

    {

    message = "" + message;

    }

    Filled (message + "<", true);

    }

    }

    gRunState.functionNestLevel ++;

    }

    // ****************

    function LogError (message)

    {

    If (gRunState.logLevel > = 1).

    {

    LogMessage ("* ERROR *:" + message, false);

    }

    }

    // ****************

    function LogExit (message)

    {

    -gRunState.functionNestLevel;

    If (gRunState.functionNestLevel < 0)

    {

    LogError ("LogExit: unbalanced nesting of function");

    }

    If (gRunState.logFunctionExit)

    {

    If (gRunState.functionNestLevel < kMaxLogNestLevel) {}

    for (var idx = 0; idx < gRunState.functionNestLevel; idx ++)

    {

    message = "" + message;

    }

    Filled (message + ">", true);

    }

    }

    }

    // ****************

    function LogNote (message)

    {

    If (gRunState.logLevel > = 3)

    {

    LogMessage ("Note:" + message, false);

    }

    }

    // ****************

    function LogWarning (message)

    {

    If (gRunState.logLevel > = 2)

    {

    LogMessage ("WARNING:" + message, false);

    }

    }

    // ****************

    function Main()

    {

    / * / / / LogEntry ("Main");

    var savedUserInteractionLevel = app.scriptPreferences.userInteractionLevel;

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

    do

    {

    Try

    {

    activeDocument var = app.activeDocument;

    If (!.) (activeDocument instanceof Document))

    {

    LogError ("hand: activeDocument isn't a Document");

    break;

    }

    var savedHorizontalMeasurementUnits = activeDocument.viewPreferences.horizontalMeasurementUnits;

    activeDocument.viewPreferences.horizontalMeasurementUnits = kUnitToUse;

    var savedVerticalMeasurementUnits = activeDocument.viewPreferences.verticalMeasurementUnits;

    activeDocument.viewPreferences.verticalMeasurementUnits = kUnitToUse;

    var savedRulerOrigin = activeDocument.viewPreferences.rulerOrigin;

    activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

    do

    {

    Try

    {

    ProcessFrames (activeDocument);

    }

    catch (Girard)

    {

    Alert ("the script encountered a situation that we don't know how to handle. "He received the error, says '" + Parker + "' in Main()"); "."

    }

    }

    While (false);

    activeDocument.viewPreferences.rulerOrigin = savedRulerOrigin;

    activeDocument.viewPreferences.horizontalMeasurementUnits = savedHorizontalMeasurementUnits;

    activeDocument.viewPreferences.verticalMeasurementUnits = savedVerticalMeasurementUnits;

    }

    catch (Girard)

    {

    Alert ("the script encountered a situation that we don't know how to handle. "He received the error, says '" + Parker + "' in Main()"); "."

    LogError ("Hand throw" + Girard);

    }

    }

    While (false);

    app.scriptPreferences.userInteractionLevel = savedUserInteractionLevel;

    / * / / / LogExit ("Main");

    }

    // ****************

    function ProcessFrames (doc)

    {

    / * / / / LogEntry ("ProcessFrames");

    var err;

    do

    {

    If (!.) (doc instanceof Document))

    {

    LogError ("ProcessFrames: doc should be a Document");

    break;

    }

    Try

    {

    var existingLayer = doc.layers.itemByName (kSizeLabelLayerName);

    existingLayer.id;

    existingLayer.remove ();

    }

    catch (err)

    {

    }

    If (kLabelNestedItems)

    {

    var pageItems = doc.allPageItems.slice (0);

    }

    on the other

    {

    var pageItems = CollectionToArray (doc.pageItems);

    }

    var frameReferences = [];

    for (var pageItemIdx = 0; pageItemIdx < pageItems.length; pageItemIdx ++)

    {

    do

    {

    var pageItem = pageItems [pageItemIdx];

    If (pageItem.itemLayer.name is kSizeLabelLayerName)

    {

    break;

    }

    var pageItem = ConvertToFrame (pageItem);

    If (instanceof TextFrame pageItem)

    {

    If (kDontLabelTextFrames)

    {

    break;

    }

    }

    ElseIf (pageItem graphic instanceof)

    {

    If (kDontLabelImageFrames)

    {

    break;

    }

    }

    on the other

    {

    If (kDontLabelOtherFrames)

    {

    break;

    }

    }

    If (pageItem.label.toLowerCase () is kIgnoreFrameLabel)

    {

    break;

    }

    var width = pageItem.geometricBounds [3] - pageItem.geometricBounds [1];

    var height = pageItem.geometricBounds [2] - pageItem.geometricBounds [0];

    If (width < kDontLabelBelowWidth)

    {

    break;

    }

    If (height, kDontLabelBelowHeight)

    {

    break;

    }

    frameReferences.push (pageItem);

    }

    While (false);

    }

    var sizeLabelLayer = doc.layers.add ({name: kSizeLabelLayerName});

    for (var pageItemIdx = 0; pageItemIdx < frameReferences.length; pageItemIdx ++)

    {

    Try

    {

    var pageItem = frameReferences [pageItemIdx];

    var width = pageItem.geometricBounds [3] - pageItem.geometricBounds [1];

    var height = pageItem.geometricBounds [2] - pageItem.geometricBounds [0];

    var labelItem = doc.textFrames.add (null, LocationOptions.BEFORE, GetOuterPageItem (pageItem));

    labelItem.itemLayer = sizeLabelLayer;

    var boxsquinch = width * height

    var boxpercent = (boxsquinch / spreadsquinch) * 100

    var roundpercent = Math.round (boxpercent)

    var labelText = "";

    If (kShowImageFileName)

    {

    var imageName = GetImageName (pageItem);

    If (imageName! = "")

    {

    labelText += imageName + kSeparatorBetweenNameAndSize;

    }

    }

    labelText += RoundString (height, kRoundToDecimals) + kSeparatorBetweenHeightAndWidth + RoundString(width, kRoundToDecimals) + kSeparatorAfterWidth + ' \r\n'+ roundpercent + '% ';

    labelItem.contents = labelText;

    xPos = pageItem.geometricBounds var [1];

    yPos = pageItem.geometricBounds var [0] + kLabelHeight;

    labelItem.geometricBounds is [Posy, xPos, yPos + kLabelHeight, xPos + kLabelWidth];.

    Try

    {

    labelItem.parentStory.characters.everyItem () .appliedCharacterStyle = doc.characterStyles.item (0);

    }

    catch (err)

    {

    }

    Try

    {

    labelItem.parentStory.paragraphs.everyItem () .appliedParagraphStyle = kLabelStyleName;

    }

    catch (err)

    {

    }

    Try

    {

    labelItem.appliedObjectStyle = doc.objectStyles.itemByName (kLabelObjectStyleName);

    }

    catch (err)

    {

    }

    }

    catch (err)

    {

    }

    }

    }

    While (false);

    / * / / / LogExit ("ProcessFrames");

    }

    // ****************

    function RoundString (numVal, decimal)

    {

    / * / / / LogEntry ("Round");

    var retVal = Math.round (numVal * Math.pow(10,decimals)) + "";

    retVal = retVal.substring(0,retVal.length-decimals) + "." + retVal.substring(retVal.length-decimals);

    / * / / / LogExit ("Round");

    Return retVal;

    }

    What do you mean?

    var myDoc = app.activeDocument;
    var mySpreads = myDoc.spreads;
    var myRectangles = myDoc.rectangles;
    var myImages = 0;
    for (var i = 0; i < mySpreads.length; i++) {
        var mySpreadWidth = 0;
        var mySpreadHeight = myDoc.documentPreferences.pageHeight;
        for (var j = 0; j < mySpreads[i].pages.length; j++) {
            mySpreadWidth += myDoc.documentPreferences.pageWidth;
            }
        var mySpreadArea = mySpreadWidth * mySpreadHeight;
        var myImages = mySpreads[i].rectangles;
        var myTotalImageArea = 0;
        var myIndividualImageArea = [];
        for (var j = 0; j < myImages.length; j++) {
            var myImageGeometricBounds = myImages[j].geometricBounds;
            var myImageWidth = myImageGeometricBounds[3] - myImageGeometricBounds[1];
            var myImageHeight = myImageGeometricBounds[2] - myImageGeometricBounds[0];
            myIndividualImageArea[j] = (myImageWidth * myImageHeight);
            myTotalImageArea += myIndividualImageArea[j];
            }
        for (var j = 0; j < myIndividualImageArea.length; j++) {
            alert("Image percentage of total images on spread " + (i + 1) + " = " + (myIndividualImageArea[j] * 100) /myTotalImageArea);
            }
       alert("Total image percentage on spread " + (i + 1) + " = " + myTotalImageArea);
       }
    
  • Control of the expression / Slider control works with the percentage?

    For example, I want to do something with keyframes, so opted to use "regulator toslide ," but is now defined by the "cursor", if I put the wiggleexpression (2.5) and place 2 on the regulator to behind the scenes, knowing that the value will be replaced by the value of "slider" so in the case of the control slide was "10". , would look like this: wiggle (10.5)

    But I want to know is if the control of the expression of origin by a percentage and not a replaced, for the value of the slider control.

    Thank you!

    If the amount of your max value is set, then by creating the cursor to drive the percentage of this number requires a few simple calculations.

    Degree of accuracy desired percentage to be hover would require a small change that in mathematics.

    This example allows you to animate a percentage of '2' frequency (maximum value) in agitation, but allows the range '5 ': stay

    mV = 2; maximum value

    PERC = (effect ("Slider Control")("Slider")/100);  makes a percentage since the slider value by using 0-100

    Wiggle(MV*PERC,5)

    explanation:

    There are several ways to do so.

    The slider is unlimited, so you can define OTHER rules in your expression, but to keep it simple:

    You must multiply your maximum value of your "perc."

    However, we want to transform the number 'perc' in a fraction.

    A simple way is to divide the amount of cursor by 100.

    Multiply your max value with the result of your cursor (/ 100) and you have your percentage.

    (* You can use fractional numbers to animate instead of this, but the cursor is easier to control in this way.)

  • Calculation of the percentage of a certain point in time

    I'm figuring the success rate based on that ID has studied a particular UNIT.

    If I want to get the rate AFTER they studied their unit of PREP01

    Right now, the code below works fine, but it considers that all the units.

    1 ID looked a UNIT in 2010 before the PREP, if I do not want to look at it.

    Also studied FGT459 in 2011 SP 1 as well as their FIRST PREP unit in SP 1 so I DON'T want to consider. IF a DEVICE WAS MADE in THE SAME UNIT of TIME THE PREP01 I WANT to IGNORE IT.

    After the PREP unit, I want to review any unit that has the status as a GIFT. so on the 3 remaning units, they passed 1 and has no 3 so the percentage is 33.3%

    Right now my code gives me 66.7% coz I condier all units.

    Suffice it to consider after PREP has been studied (PRESENT) IF a UNIT AT the SAME TIME AS the PREP01 UNIT I WOULD IGNORE IT AS.

    Thanks for any help.

    The code I tried is:

    Select d1.id, ROUND (avg (case PASS_OR_BETTER

    When 'Y', 1

    0 otherwise

    (end) * 100,1) as Col.

    OF D1, D2 DAN_SPIL_GRADE DAN_SPIL_GRADE_IDS

    WHERE D1. RANK = D2. GRADE

    AND D1. STATE = 'PRESENT '.

    D1.id group

    TABLE1:


    CREATE TABLE DAN_SPIL_GRADE_IDS
    (VARCHAR2 (8) ID,)
    UNIT VARCHAR2 (8).
    STATUS VARCHAR2 (8).
    GRADE VARCHAR2 (12),
    VARCHAR2 (12) OF THE YEAR.
    PERIOD VARCHAR2 (12));

    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'FGT458', 'PRESENT', 'HD', ' 2010', "SP4");
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'FGT459', 'PRESENT', 'HD', ' 2011', "SP1");
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'PREP01', 'PRESENT', 'P', '2011', "SP1");
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'OPT878', 'AWAY', 'F', '2011', 'SP2');
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES (1 ', 'FRE111', 'PRESENT', ', ' 2011', 'SP3');
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'PREP02', 'PRESENT', 'F', '2012', "SP1");
    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD) VALUES ('1', 'PREP03', 'PRESENT', 'F', '2013', "SP4");

    IDUNITSTATUSGRADEYEARPERIOD
    1FGT458CURRENTLYHD2010SP4
    1FGT459CURRENTLYHD2011SP1
    1PREP01CURRENTLYP2011SP1
    1OPT878APSENTF2011SP2
    1FRE111CURRENTLYD2011SP3
    1PREP02CURRENTLYF2012SP1
    1PREP03CURRENTLYF2013SP4

    TABLE2


    CREATE TABLE DAN_SPIL_GRADE
    (RANK VARCHAR2 (8))
    PASS_OR_BETTER VARCHAR2 (12));

    INSERT INTO DAN_SPIL_GRADE (RANK, PASS_OR_BETTER) VALUES ('HD', 'Y');
    INSERT INTO DAN_SPIL_GRADE (RANK, PASS_OR_BETTER) VALUES (',' Y');
    INSERT INTO DAN_SPIL_GRADE (RANK, PASS_OR_BETTER) VALUES ('P', 'Y');
    INSERT INTO DAN_SPIL_GRADE (RANK, PASS_OR_BETTER) VALUES ('F', ' don't);

    GRADEPASS OR BETTER
    HDTHERE
    DTHERE
    PTHERE
    FN

    Gives:

    IDSUCCESS RATE
    166.7

    Here you are

    IDSUCCESS RATE
    133.3

    Hello

    A condition in a WHERE clause can cause an entire line is ignored.

    The same condition in a CASE expression can cause individual values is ignored, while keeping the line.

    You can modify the solution of knapen, remove the comparison of the unit_temp to 'PREP01' in the WHERE clause and put it in the expression BOX, like this:

    Select id

    tour

    (

    AVG

    (

    case

    When unit_temp = "PREP01" then NULL - compare here

    When pass_or_better = "Y" then 100

    0 otherwise

    end

    )

    1

    ) as Col.

    de)

    Select a.id

    a.unit

    b.pass_or_better

    a.year

    a.period

    , max (decode (unit, 'PREP01', 1, 0)) flag (partition by a.id stopped by year, period, unit)

    , max (unit) keep (dense_rank from first order to decode (unit, 'PREP01', 0, 1)) on unit_temp (partition by id, year, period)

    of dan_spil_grade_ids one

    Join dan_spil_grade b

    On a.grade = b.grade

    and a.status = 'PRESENT '.

    )

    where flag = 1

    - and unit_temp! = "PREP01" - not here

    Group

    by id;

    The display of your sample with this added line data:

    INSERT INTO DAN_SPIL_GRADE_IDS (ID, UNIT, STATUS, CATEGORY, YEAR, PERIOD)

    VALUES ('2', 'PREP01', 'PRESENT', 'F', '2012', 'SP3');

    is

    ID PASS

    -------- ----------

    1 33.3

    2

  • Calculation of the percentage

    Hi, I need help creating a calculation field that would be the percentage of the values obtained from the groups radio button in acrobat 9.0.

    I have essentially ten groups radio button (ODIO1, ODIO2, ODIO3, ODIO4, ODIO5, ODIO6, ODIO7. ODIO8, ODIO9, ODI10).  They

    each have six radio buttons/chocies that correspond to values of button of 0,1,2,3,4 and 5.

    I need essentially a calculation field that displays the percentage of groups with the equation = (SUM(ODI01-ODI10)/50) * 100%.

    It would give me a value from 0 to 100%.

    I have little experience in the use of Javascript, so any help to the creation of a Javascript script to use this equation is greatly appreciated.

    Thank you!

    If you use a percentage field the result must be a number between 0 and 1, not 100...

    In any case, copy the following code reproduces your formula:

    var total = 0;

    for (var i = 1; i)<=10;>

    total += + (this.getField ("ODIO") + i) .value;

    Event.Value = (total: 50) * 100;

  • Round the numbers...

    Hi all

    So, I have developed a project with the help of kglad in which the user enters into a digital quantity in an input text area and 3 other boxes (dynamic text boxes) displayed the digital amounts based on this entry.

    With the help of kglad I got everything works perfectly except that these 3 squares do not round the results they display.

    For example, if I enter 265.35 (text field 1) tf1, tf2 displays 132.675, tf3 tf4 poster 132.675 poster 66.3375. Now, according to the calculation that is scheduled, that is right. But I need them to view: 132,68 66.34 and 132,68, be rounded upwards or downwards accordingly.

    Any ideas?

    :

    TF1.addEventListener (Event.change, F1);

    tf5.addEventListener (Event.change, F2);

    Function f1(e:Event) {}

    TF2. Text = String (Roundf(3) (Number (TF1. Text) / 2.2));

    TF3. Text = String (roundT (Number (TF1. Text) / 4.2));

    TF4. Text = String (Number (TF1. (Text) / 2);  //etc

    sumF();

    }

    function f2(e:Event) {}

    TF6. Text = String (Number (tf5. (Text) * 12/24); // etc

    TF7. Text = String (Number (tf5. (Text) * 12/52);

    TF8. Text = String (Number (tf5. (Text) * 12/26);

    sumF();

    }

    function sumF() {}

    {if (!) IsNaN (Number (TF1. Text)) &! IsNaN (Number (tf5. (Text)))}

    for (var i = 1; i)<>

    This ["TF" +(i+8). ToString()] .text = String (Number (this ["tf" + i.toString ()] .text) + Number (this ["tf" +(i+4)].text.toStri ng()));

    }

    }

    }

    function roundF(n:Number,places:uint):Number {}
    var f: Number = Math.pow(10,places);
    return Math.round (n * f) /f;
    }

  • Calculation of the percentages of subqueries

    I got two sets of data - the total amount of renewable possible (IE sales last year) and the amount renewed (IE sales this year). What I need is a query that takes these two numbers and spits out the percentage renewed - (renewed / renewable) * 100. Complicated bit is I need to do this for each quarter - so I really need (sum (renewed) / sum (renewable)) * 100. The query below is my attempt to get the right numbers.

    The first select in the FROM statement below (with an alias as c) returns the total renewable for each quarter, as follows (the letters refer to specific products):
    Quarter          E                  S                  P                 F               Total
    First     339280.93     119124.45     713,588.08     37628.03     1,209,621.49
    Second     292568.55     101816.04     444,521.27     41894.42     880,800.28
    Third     460329.66     115907.42     452,387.62     66382.78     1,095,007.48
    Fourth     376677.66     112729.72     448,698.84     53152.44     991,258.66
    The second subselect in reports (with an alias like f) FROM total renewed for each quarter, as follows:
    Quarter          E                S                  P                 F                Total
    First     308735.15     82457.86     395,650.36     19520.87     806,364.24
    Second     109025.85     45634.73     113,095.45     20157.75     287,913.78
    Third     0.00          0.00     0.00     0.00     0.00
    Fourth     0.00     0.00     0.00     0.00     0.00
    When I run the query, I get four lines for each quarter, which is clearly not correct. For each quarter there are two rows which are all zeros, a line that has the correct percentages and the other with only garbage numbers.
    First                0.00                0.00                0.00                0.00                0.00
    First               91.00               69.22               55.45               51.88               66.66
    First               32.13               38.31               15.85               53.57               23.80
    First                0.00                0.00                0.00                0.00                0.00
    Second                0.00                0.00                0.00                0.00                0.00
    Second                0.00                0.00                0.00                0.00                0.00
    Second               37.27               44.82               25.44               48.12               32.69
    Second              105.53               80.99               89.01               46.60               91.55
    Third                0.00                0.00                0.00                0.00                0.00
    Third               67.07               71.14               87.46               29.41               73.64
    Third               23.68               39.37               25.00               30.37               26.29
    Third                0.00                0.00                0.00                0.00                0.00
    Fourth               28.94               40.48               25.21               37.92               29.05
    Fourth               81.96               73.15               88.18               36.73               81.35
    Fourth                0.00                0.00                0.00                0.00                0.00
    Fourth                0.00                0.00                0.00                0.00                0.00
    I tried to add the outermost Select, but then I can't understand a good group of. Any help on this would be appreciated, thanks.
    Select C.Quarter As Quarter_Name, 
           Round((F.E_Revenue / C.E_Revenue) * 100, 2) As E_Revenue,
           Round((F.S_Revenue / C.S_Revenue) * 100, 2) As S_Revenue,
           Round((F.P_Revenue / C.P_Revenue) * 100, 2) As P_Revenue,
           Round((F.F_Revenue / C.F_Revenue) * 100, 2) As F_Revenue,
           round((f.total_revenue / c.total_revenue) * 100, 2) as total_revenue, 
           c.sortcol as sortcol
        from 
            (SELECT DECODE(B.QUARTER_NAME, 1, 'First', 2, 'Second', 3, 'Third', 4, 'Fourth', 'Unknown') AS QUARTER, 
                   SUM(B.e_revenue) AS E_REVENUE, 
                   Sum(B.s_revenue) As S_Revenue, 
                   SUM(B.p_revenue) AS P_REVENUE, 
                   SUM(B.f_revenue) AS F_REVENUE, 
                   SUM(B.total_revenue) AS TOTAL_REVENUE, 
                   b.quarter_name as sortcol
                From
                     (Select mth.Quarter As Quarter_Name, 
                           Nvl((Select renewable_amt.Net_Revenue From renewable_amt Where renewable_amt.Product_Code = 'extended' And renewable_amt.Month_Id = A.Month_Id), 0) As e_revenue, 
                           Nvl((Select renewable_amt.Net_Revenue From renewable_amt Where renewable_amt.Product_Code = 'standard' And renewable_amt.Month_Id = A.Month_Id), 0) As s_revenue, 
                           Nvl((Select renewable_amt.Net_Revenue From renewable_amt Where renewable_amt.Product_Code = 'professional' And renewable_amt.Month_Id = A.Month_Id), 0) As p_revenue, 
                           Nvl((Select renewable_amt.Net_Revenue From renewable_amt Where renewable_amt.Product_Code = 'forecaster' And renewable_amt.Month_Id = A.Month_Id), 0) As f_revenue,
                           nvl((Select Sum(renewable_amt.Net_Revenue) From renewable_amt Where renewable_amt.Month_Id = A.Month_Id), 0) As total_revenue
                        FROM (SELECT DISTINCT renewable_amt.MONTH_ID FROM SMS.renewable_amt WHERE renewable_amt.FISCAL_YEAR = DECODE(EXTRACT(MONTH FROM TO_DATE(:H_P16_REPORTDT, 'DD-MON-YY')), 11, EXTRACT(YEAR FROM TO_DATE(:H_P16_REPORTDT, 'DD-MON-YY')) + 1, 12, EXTRACT(YEAR FROM TO_DATE(:H_P16_REPORTDT, 'DD-MON-YY')) + 1, EXTRACT(YEAR FROM TO_DATE(:H_P16_REPORTDT, 'DD-MON-YY')))) A, 
                             companyx.Month mth
                      Where mth.Month_Id = A.Month_Id) B
            GROUP BY B.QUARTER_NAME) c,
            (Select decode(e.Quarter_Name, 1, 'First', 2, 'Second', 3, 'Third', 4, 'Fourth', 'Unknown') as quarter, 
                   SUM(e.e_revenue) AS E_REVENUE, 
                   SUM(e.s_revenue) AS S_REVENUE, 
                   SUM(e.p_revenue) AS P_REVENUE, 
                   SUM(e.f_revenue) AS F_REVENUE, 
                   Sum(e.total_revenue) As Total_Revenue, 
                   e.quarter_name as sortcol
                from
                    (Select mth.quarter As quarter_Name, 
                           Nvl((Select renewed_amt.Renewed_Net From renewed_amt Where renewed_amt.Product_Code = 'extended' And renewed_amt.Month_Id = d.Month_Id And trunc(renewed_amt.report_dt) = :H_P16_REPORTDT), 0) As e_revenue, 
                           Nvl((Select renewed_amt.Renewed_Net From renewed_amt Where renewed_amt.Product_Code = 'standard' And renewed_amt.Month_Id = d.Month_Id And trunc(renewed_amt.report_dt) = :H_P16_REPORTDT), 0) As s_revenue, 
                           Nvl((Select renewed_amt.Renewed_Net From renewed_amt Where renewed_amt.Product_Code = 'professional' And renewed_amt.Month_Id = d.Month_Id And trunc(renewed_amt.report_dt) = :H_P16_REPORTDT), 0) As p_revenue, 
                           Nvl((Select renewed_amt.Renewed_Net From renewed_amt Where renewed_amt.Product_Code = 'forecaster' And renewed_amt.Month_Id = d.Month_Id And trunc(renewed_amt.report_dt) = :H_P16_REPORTDT), 0) As f_revenue,
                           nvl((Select sum(renewed_amt.renewed_net) From renewed_amt Where renewed_amt.Month_Id = d.Month_Id and trunc(renewed_amt.report_dt) = :H_P16_REPORTDT), 0) As total_revenue
                        From (Select Distinct renewed_amt.Month_Id From Sms.renewed_amt Where trunc(renewed_amt.report_dt) = :H_P16_REPORTDT) d, 
                             companyx.Month Mth
                      Where mth.Month_Id = d.Month_Id) e
            Group By E.Quarter_Name) F
    order by sortcol;       

    Hello

    It looks like you are a cross between c and e join.
    Shoudn't you have a join condition, something like that?

    ...               Where mth.Month_Id = d.Month_Id) e
            WHERE    c.quarter_name = e.quarter_name              -- Added
            Group By E.Quarter_Name) F
    order by sortcol;       
    

    If this does not resolve the problem, after a few examples of data (CREATE TABLE and INSERT statements) and the results desired from these data.

Maybe you are looking for

  • resarioCQ61 poster: BOOTMGR is press Ctrl + Alt + Delete to restart

    Hello! As a result of all the information provided online, I tried system restore and system diagnostics. I made a short and long test and my computer says "HDD full 1 (305).Any ideas where I can go from here? HP says I have to buy a recovery disc fo

  • Display of online identities.

    Recently, a friend thought she me, post on a sensitive issue under an alias by using the Opera browser to access the site recognized... So she typed the alias in the search for EI and Bingo, my name and the location came?  I thought she was funnine m

  • Firmware - BEFSR41 V4.3 update error

    When trying to install my router BEFSR41 firmware version 2.00.4 V4.3 build 5 version 2.00.02, I have the following error and the firmware is not upgraded. Caveat! Upgrade file error model. Thanks in advance for any help. Best regards, Bruce

  • Routing IPSec problem?

    Hi all. I have a problem with an IPSec tunnel that I am trying to create between two sites. Transformations and pre-shared keys have been configured, and the tunnel came briefly last night. The problem is that I can't ping across the tunnel's private

  • Cannot download documents

    Whenever I try to download a document from the web or open an attachment, it does not open and says he has a virus on it. It automatically removes it.