Calculation of a field with a minimum of response?

Hello all-

I have a product which costs $22 per thousand. I have a field for the quantity and a total field.

Right now I have it set up like this:

Area 1: 'Qty 3' - customer enters the desired quantity

x

Field 2: '22' - hidden, used for multipliers

x

Area 3: "001" - hidden, used.001 for multiplier give the total price.

My problem is that the minimum price is always $ 22. How to ensure that the total word: "If the total is < = 22, then 22.» Another thing, Total. »

Thank you. No idea on javascript...

You can use the following in the custom field calculation script:

(function () {

    // Get the quantity
    var v = getField("Qty 3").value;

    // Set the price per thousand
    var costPerK = 22;  // Cost/thousand

    // Set the minimum cost
    var costMin = 22;

    // Calculate the total cost
    var costTotal = v * costPerK / 1000;

    // Set this field to the total cost if it's more than the minimum, otherwise use the minimum
    event.value = (costTotal > costMin) ? costTotal : costMin;

})();

You don't say what you want to happen if field 3 is empty. If you want the value to be blank, add after line that gets the amount:

if (v == 0) {
    event.value = "";
    return;
}

Tags: Acrobat

Similar Questions

  • Receive error message when calculating the two fields with different date format

    I'm more familiar with SQL Server and Oracle, then after a search online without success, I ask here.

    I use developer PL/SQL with DB Oracle 11g Release 11.2.0.2.0 Enterprise 64-bit

    MyTable:

    ID_Number VarChar2

    Date of Date_Received

    Select ID_Number,

    Date_Received,

    To_Date (substr (ID_Number, 1.6), "YYMMDD") SentDate,.

    Date_Received - NumDays To_Date (substr (ID_Number, 1.6), "YYMMDD")

    FROM MyTable

    Where substr (ID_Number, 7.3) in ('ABC', 'ABD')

    and length (Trim (translate ((substr (ID_Number, 1,6)), '0123456789',' '))) a null value

    ID_Number Date_Received SentDate NumDays

    131002ABC1654106 10/16/10/2013-2013 14 2

    131004ABD8813899 4/12/2013-4/8/2013 4

    131014ABD1844832 10/16/10/14 OF 2013-2013 2

    Sometimes the first 6 characters in the ID_Number aren't the numbers and length (Trim (translate deletes records))

    I want just the records where NumDays > 2

    I tried to put the request in a subquery and using where NumDays > 2 outside.  I also tried using the calculation directly in the Where clause.  Without it in Where clause it works very well, with him in a place, I get the following error:

    ORA-01931: Date format picture ends before converting all of the input string


    I don't know how to put the two dates in the same format.  I tried to declare the format without result.  I don't understand how I can calculate in the selection, but do not use the same calculation in Where clause.

    Thank you for your help.

    Hello

    SQL is a language to describe the desired results.  How the system gets these results belongs to you don't have much say about which conditions will be applied when.

    One place where you can control the order of things is a CASE expression.  When you say

    CASE

    WHEN condition_1

    THEN expression_1

    END

    You can be sure that expression_1 will be evaluated only when cond_1 is set to TRUE.

    Try something like this:

    WITH got_sent_date AS

    (

    SELECT id_number, date_received

    CASE

    WHEN the TRANSLATION (SUBSTR (id_number, 1, 6)

    , 'x' 0123456789 '.

    , 'x'

    ) IS NULL

    THEN TO_DATE (SUBSTR (id_number, 1-6)

    , "YYMMDD".

    )

    END AS sent_date

    FROM MyTable

    WHERE (id_number, 7, 3) SUBSTR ("ABC", "ABD")

    )

    SELECT id_number

    date_received

    sent_date

    , date_received - sent_date AS num_days

    OF got_sent_date

    WHERE date_received > sent_date + 2

    ;

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

    Of course, you'll still errors of execution if id_number starts with 6 digits, but they do not have to be valid, for example '131100' or '130229'.  This is one of the reasons why the date information storage in VARCHAR2 columns are a bad idea.  To work around this problem, see

    https://forums.Oracle.com/message/4255051

  • Validate a field with the minimum and maximum values

    How can I register a form in Livecycle designer?

    http://www.java2s.com/code/JavaScript/form-control/Validateaninputfieldwithminimumandmaxim umvalues.htm

    Can someone help me with a sample?

    Just replied to your other thread.

    Paul

  • I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    The formula is just + Cash.  I don't know how to tell him to look on Page 1.  If I use the same domain on Page 1, the formula works so I know that this is not something in the name of the field.

    It received NO response

    Page1.cash should do it. If not, you can use CTRL + click to enter its name in your script.

    1. Select the field that you add the script.
    2. Scroll the design view until you can see the object whose name you need. (Is not necessary if the object is already in mode)
    3. Click inside the script window to place the cursor where you want the name of the other object.
    4. Hold down the CTRL key while clicking the object whose name you need.
  • Fill a field with a value only if another field has been filled?

    I'm looking to fill a field with a predetermined only if another field is not empty. I have no idea how to proceed.

    Any help would be appreciated.

    Thank you

    Use this code in the custom calculation of LineRow1 script:

    Event.Value = (this.getField("SourceDescriptionRow1").valueAsString == "")? « » : « 001 » ;

  • When a box is checked, fill a text field with a value

    I don't know that it's simple; However, I am very new to acrobat and javascript.

    Here's what I want to do:

    I have a checkbox field and a text field. If the checkbox is turned "on" I want to fill the text field with a specific numeric value.  If she isn't 'unchecked' there is not value or value 0.  Any help is appreciated.

    Enter this code in the custom of your text field calculation script:

    This.getField("CheckBox1").value = Event.Value == "Off"? 0: 1234;

  • Time sheet calculation of time fields (TimeIN + TimeOUT) - (BreakIN + BreakOUT)

    Hello


    I'm really a novice in the field of pdf script, I would like to ask if someone could help me make a calculation script of a time field with a TOTAL production WORKED HOURS in a day to a calculation of

    (TimeIN + TimeOUT) - (TimeBreakIN + TimeBreakOUT)

    still other topics that the TimeIN, timeout, the TimeBreakIN or the TimeBreakOUT can also run through midnight

    I'm looking for other forums, but not found anything that could match my needs.

    Time at: 17:00

    TimeBreakIN: 20:00

    TimeBreakOUT: 21:00

    OUT time: 02:30

    the script that I expected to be in the

    TOTAL HOURS WORKED is: 8.50 (or 08:30)

    I will be also repopulate this script to each row/day until I add in 1 pay as a TOTAL period

    Thanks in advance to those who can help me.

    Hi JunPapay,

    You may want to take a look at this: calculations between two time fields

    Thank you

    Abhishek

  • Number of fields with If then statement

    Greetings,

    I use Adobe Acrobat Pro XI.  "On a form I created, there are fields named"RLRow1", RLRow2," RLRow3 "etc all the way up to RLRow13, assuming that there are 13 lines of data that need to be registered.  The staff is required to enter the letter 'L' or the letter 'R' in these areas.  I have already added the Custom Format Script of ' event.value = event.value.toUpperCase (); "to convert uppercase text.  On this form, I have a field called "Total L" and a field called 'R Total'.  I would like to add a javascript function which counts the number of 'L' RLRow1, RLRow2 etc and put the total in the field 'Total L '.  Likewised, I would like to add a javascript function that counts the number of 'R' RLRow1, RLRow2 etc. and puts this total in the field 'Total R '.  I guess it would be some type of instruction If Then, but I'm not familiar enough with Javascript.  I hope that's not too complicated.  Can anyone help with this?

    First, if these are the only values allowed then use a drop-down list instead of a text field, but never mind.

    You can use the following code in the custom calculation of the field 'Total L' script. It is easily adjusted for the field 'Total R' thus:

    var total = 0;
    for (var i=1; i<=13; i++) {
        if (this.getField("RLRow"+i).valueAsString=="L")
            total++;
    }
    event.value = total;
    
  • Problems with the filling of a text field with 2 other fields data


    I have 3 domains Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.

    Tools_1a_pri is a drop-down list box with a predefined list. One of the options is the 'other '.  If 'Other' is selected, the text Tools_1a_pri_other field becomes visible for users to enter the name of the other tool.

    The Tools_1a_pri_txt is a text field with a calculation that shows a text indicating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.

    When I select one of the predefined tools, everything works.  When I choose the other, it seems that nothing has changed.  Must I click another field before.  It's confusing for the user.

    Tools_1a_pri validate code
    this.getField("Tools_1a_pri_Other").display = event.value is "Other"? Display.visible: display.hidden;

    Computer Tools_1a_pri_txt code
    If nothing is selected, follow these steps
    If (getField("Tools_1a_pri").value.length < 2) {}
    event.target.textColor = color.red
    Event.Value = "no identified main tool";
    } else if (getField("Tools_1a_pri").value! = 'Other') {}
    If not do that if the other is selected
    event.target.textColor = color.black
    Event.Value = getField("Tools_1a_pri").value;
    } else if (getField("Tools_1a_pri").value = 'Other') {}
    If not do so if the other is not selected
    event.target.textColor = color.black
    GetField("Tools_1a_pri").value = Event.Value + "-" + getField("Tools_1a_pri_Other").value;
    }

    You have made the classic mistake of using the assignment operator in a statement instead of the comparison operator. Change this line:
    } else if (getField("Tools_1a_pri").value = 'Other') {}

    To do this:

    } Else if (getField("Tools_1a_pri").value == 'Other') {}

  • Text field with AutoComplete is always NULL

    Greetings,

    I am new to Apex, so I don't know I'm missing something obvious. I use Apex 4.0.1 what I've done is created a form on a page of table and added a new text with page of AutoComplete element. This new field of text does not match a column in the table. What I'm trying to do, is allow the user to use the AutoComplete feature to make a choice. Then when the user submits the page, I want to use the substr function on the value of the field of AutoComplete and fill one of the fields in table. I tried using the PL/SQL functions in validations and calculations, but I found that the autocomplete field value is always NULL. I can access the other fields that are associated with a fine table column. It must be something simple. Thanks for your help.
    Page Items
    P2_F1  - text field with auto complete. Not associated with a table column
    P2_F2 – Text field. Is associate with a table column
    This is what I want to do:
    
    Entered this in a validation
    begin
    if :P2_F1 is not null then
       :P2_F2 := substr(:P2_F1,1,5);
    end if;
    end;
    Thanks again

    Published by: LRM on 22 January 2011 17:25

    Hello

    In calculations, you must use:

    Item name: P2_F2
    Type: SQL Expression
    Point calculation: after submit
    calculation: substr(:P2_F1,1,5)
    Condition type: the value of element in the expression is not null
    Expression 1: P2_F1

    Kind regards

    Patel Kartik
    ---------------------------------------------------------------
    http://patelkartik.blogspot.com/
    http://Apex.Oracle.com/pls/Apex/f?p=9904351712:1

  • How can I get rid of a green field with a white check mark in that box covers some of my photos and on the windows for firefox icon.

    How can I get rid of a green field with a white check mark in that box covers some of my photos and on the windows for firefox icon. Edit

    Hello
    I want to thank everyone for the information, I had to uninstall Norton in order to get the green boxes deleted. Thank you once again problem fixed.

  • Impossible to install on the PC field with redirected folders

    I'm trying to install Skype on a PC field with redirected folders and the installation crashes with

    "Invalid drive H:\. "then code 1603.

    It is a portable Windows Pro 8.1 with all updates. My Documents and the office are redirected to the H: drive with offline files enabled and it is currently connected to the network.

    I installed with the MSI of Skype version and installation is perfect.

  • How to read several channels simultaneously with a minimum

    Hi all

    Please see the attached file. In fact, this is a simplified example of my real application, I didn't understand the second half to reduce the complexity.

    As demonstrated, I have two entries of analago I need to read (position and acceleration) with a SPECIFIC requirement which is:

    At the same time, I make some decisions based on data more recently acquired in the "timed loop. The decision part is not included in this vi. for simplicity. But the fact is that I just need the most recent data (as well as online) make a kind of decisions.

    Everything seems fine and it seems that I collect data in a way desired interval of 1msec. BUT I just discovered that the data I read (in the timed loop) are the most recent one compare is not to the real sensors. In other words, there is a delay in the acquisition process. The value in the timed loop is like 100 msec delayed the release of real sensor, which is generated by the sensor and acquired by DAQ card.

    This problem makes my decision making part of constantly decide according to the before value of 100 msec. Unfortunately, it's terrible to my request, i.e. it is an intolerable delay to the process.

    Are my settings of data acquisition as samples per channel, the number of samples per channel or right of sampling rate? I appreciate if someone can help me with this application. I just need to collect data at 1 kHz, as close as possible in real-time (online) or with a minimum delay, not 100 msec.

    Thank you.


  • Problem with Spotlight fields with the higher priority than browserfield

    It comes to JRE6.

    Some Web sites make a redirect of content or another ajax request when the document is loaded.  When the screen contains a browserfield and a focusable field with a higher priority, an illegal state Exception is thrown by the browser because it is not to the point when the content refreshes the field.  (As in defining BrowserField.setFocus () before calling BrowserField.refresh ()).

    Example: http://supportforums.blackberry.com/t5/Java-Development/BrowserField-Sample-Code-Create-your-first-B...

    Using the code of the BrowserField2 example, simply by adding a ButtonField in the survey except title when navigating to twitter.com.  Other sites work fine, but when the content/javascript is in a certain way on Twitter, she seems to have some problems.

    package mypackage;
    
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.browser.field2.*;
    import net.rim.device.api.ui.*;
    
    class MyBrowserField2Sample extends UiApplication
    {
        private MainScreen _screen;
        private BrowserField _bf2;
        private ButtonField btnField;
    
        MyBrowserField2Sample()
        {   
    
            btnField = new ButtonField();
            btnField.setLabel("A BUTTON");
    
            _bf2 = new BrowserField();
    
            _screen = new MainScreen();
            _screen.setTitle(btnField);
            _screen.add(_bf2);
            pushScreen(_screen);
    
            _bf2.requestContent("http://www.twitter.com");
        }
    
        public static void main(String[] args)
        {
            MyBrowserField2Sample app = new MyBrowserField2Sample();
            app.enterEventDispatcher();
        }
    }
    

    The code above throws an illegal state exception at startup.  If you delete the setTitle (or any field focusable) that has a higher priority than the browserfield, so it works well.

    How can I force the focus on the browserfield when she needs?

    I Googled, found issues similar and all say "force focus on the browserfield", but even if you force the focus, the same illegal state occurs due to the updating of the content.

    Thanks in advance,

    Nate

    After reviewing the matter further, the problem may be to the field focusable, but it doesn't have to be on top.  Basically, any field focusable on the same screen as the browserfield throws the exception.

    While going to twitter.com in blackberry browser works very well (sends you to the mobile site), this behavior causes problems with the browserfield.

    The workaround, is just to force the link to open the mobile site directly.

  • Text field with AutoComplete do not store Item Value for Cascading LOV

    Hello

    I have created a form to the APEX 4.2, and two elements on the page have a problem. The first point is a text field with AutoComplete for the PROVIDER. The second element is a list select number that has the PROVIDER as part of waterfall to fill.

    When a user selects one of the values that the field can be seized semiautomatic provider , the value autocomplété should make the selection list produce the numbers respective associated PROVIDER. The problem that I am running is that AutoComplete is not give PROVIDER selection list value is filled.

    For example: if I type 'st' in the PROVIDER field that autocompletes to "steve" is selected, the NUMBER field must interrogate him for the numbers where VENDOR = steve. However, after reviewing the Session State from the PROVIDER element, the contained value is always only "st."



    Here are the settings I have for the field PROVIDER : and NUMBER:

    name.JPGnumber.JPG

    There should be a way to have the value of the seized field semi-automatic to account for what appears after selecting a value, but I don't know what it is. You can provide any help would be appreciated.

    Thank you!

    your query full auto would: select supplier_name | ' ('| supplier_id |') '

    provider AutoComplete onChange, get the supplier_id and then value the selected drop-down list by using this code.

Maybe you are looking for

  • Download firmware Sony and software IObit "failed" repeatedly?

    I had intermittent problems with the download failures. Today, I tried an update of the firmware of Sony A99 and he failed twice. I dropped Fire fox and used IE. Result was quick and my camera has the most recent Version. I tried a few months ago the

  • Computer laptop 15-ay012nl: RAM

    Hello 2 questions on this laptop, I can't find the info on the data sheet. How many slots does RAM have? Maximum RAM supported? Thank you

  • Folder my documents is missing in windows xp pro sp3 Explorer

    Folder my documents is missing in Explorer - power users account not shared documents folder watch. If I change my account to a professional folder my documents is visible in the Explorer. My security documents folder is set to my user account - - Sy

  • automatic update KB2656369 keep over and over asking to download?

    I also KB2656352 to update security and KB2633880 asking to download several times? What can I do to fix this?

  • Build 6002

    Windows Vista Home Premium give me this message: this copy of Windows is not genuine. Sometimes I'm propmted to activate Windows now! What should I do? Desforges