Javascript Syntax: Return the greater of summed range or "0"

I am using Windows 7 and Adobe Acrobat X.
I have a field in which I want to show the sum of a range of fields. However, if that summed value is negative I want it to display a "0".  I'm not sure of the syntax I need to use in order to get this result.  I know how to do it in Excel, but not in Javascript.  I found a thread for something somewhat similar but I think my issue lies in how I'm expressing the "sum" part of the formula.  No matter what I do nothing seems to happen in the field.  See below:
if (sum(this.getField("SecurityDeposit"),this.getField("Credit"),this.getField("OutstandingC harges"),this.getField("RepairCosts"),this.getField("OtherCosts"),this.getField("Interest" )).value > '0') {
event.value = sum(this.getField("SecurityDeposit"),this.getField("Credit"),this.getField("OutstandingCh arges"),this.getField("RepairCosts"),this.getField("OtherCosts"),this.getField("Interest") )
} else {
event.value = 0 // Default value here

Try changing the line:
if(fField.toString() != '') {
to:
if(fField.toString() != '' ||  fField.value == 0) {

Similar Messages

  • Is there a way to get a (return) value back after running Javascript statements in the backing bean?

    I have a usecase  where I need to run a javascript function from within the backing bean and get the value returned by the function.
    Example:
              In Java I have two variables  x and y, I want the javascript to return the larger value z.
              This is what I'm doing, but I have no means to get the values of variable z.
              StringBuilder script = new StringBuilder();
              script.append("var  z;");
              script.append("var  x = " + x + ";");
              script.append("var  y = " + y + ";");
              script.append("if  (x > y)  z = x  else z = y");
              FacesContext fctx = FacesContext.getCurrentInstance();
              ExtendedRenderKitService erks = Service.getRenderKitService(fctx,
              ExtendedRenderKitService.class); erks.addScript(fctx, script);
         The actual usecase is a bit complicated. It's a dragNdrop paradigm.
         I cannot capture the muse Release event (DropEvent ?) in the client side as (most likely) it is captured by ADF.
         The drop target is a RichTextEditor. I need to convert the DropEvent.getDropX() and DropEvent.getDropY() to get the caret position in the text editor.
    Any other solution to the issue is highly appreciated.
    Thanks,
    -ab

    you can try it!
    erks.addScript(fctx, js_funcation_name("'"+x+"'","'"+y+"'","'"+x+"'","'"+x+"'",.....));//bean-> javaScript
    add javascript:
                   AdfCustomEvent.queue(p, 'XXXXX', {parameter:parameter_value},true);
    add:
    <af:serverListener type="XXXXX" method="#{ManageBean.funcation}"/>//js->bean

  • Trying to return the size of the bag's range

    can some one help me with these... im not sure if i just need to do a return statement. if someone can give some advice that would be great.. thanks
            public interface BagOverIntRange {
          * Returns the size of the bag's range (high - low + 1).
    // do i need to scan this ? or is this more simple?
         public int rangeSize();
          * Returns the lower bound of the bag's range.
         public int rangeLow();
          * Returns the upper bound of the bag's range.
         public int rangeHigh();

    What are you talking about. You posted an interface definition, and the method definitions in it look ok. I don't understand the question in the comment of the rangeSize method definition. It's just a definition in the interface, not an implementation.

  • Using Javascript to rotate images with the style.backgroundImage property & I leave the onload pg & return, the images have trouble loading.

    I'm using Javascript to rotate background images -->
    function rotateImages() {
    setInterval("startRotator()", 7000);
    var counter = 0;
    function startRotator() {
    var images = ["images/finance1.jpg","images/finance2.jpg","images/finance3.jpg","images/finance4.jpg","images/finance5.jpg","images/finance6.jpg"];
    if( counter >= images.length ) {
    counter = 0;
    var image = "url('" + images[counter] + "')";
    counter++;
    document.body.style.backgroundImage=image;
    The script is triggered by the load event when the homepage loads and the script only runs on the homepage. Everything works fine upon opening the homepage.
    If I leave the home page and return, the images will have trouble loading for about 3 to 5 cycles and I'll get white backgrounds for part of the time. The same thing happens if I enter the site from a page other than the homepage and then go to the homepage.
    I discovered, however, that if I enter the site at the homepage and then leave the homepage and return using the back button, everything runs fine. Apparently it then accesses a cached version of the homepage? Seems having two cached versions creates a conflict?
    This problem only happens with Firefox (I have ver 29.0.1). It does not happen on IE ver 11, Chrome ver 34, or Safari ver 5.1.7.
    I get the same problem with XP, Win7, and Win8 but, only on Firefox.
    Can you please fix this?

    Hey, I am trying to reproduce this here: [http://jsfiddle.net/u3TLb/]
    Mozillazine forums and the [http://webcompat.com] are more specialized in Web Compatibility, please ask there as well.

  • Formula mode (Returns the most repetitive  value in range of data)

    Hi all,
    I'm using XIR2.0 but in the next month we will use R3, does anybody knows if the mode (Returns the most frequently occurring, or repetitive, value in an array or range of data. ) formula exist in this new version?
    Thanks.

    Hi all,
      The formula exists in WEBI is MODE, this formula doesn't exists in DESKI.
    Thanks.

  • Coding - returning the number of characters in a text box.

    I am in the process of creating a cell phone simulation/animation in Edge Animate CC for use in a Captivate course. Basically, when a user clicks on number buttons on the virtual keypad, it displays the numbers in a text box , just like an actual cell phone would display the phone number on the screen as a caller is dialing. So, the user would click seven buttons and a seven-digit phone number appears on the virtual phone screen.  This part of my animation works great and all seven digits appear, but I would like to modify the code so that a hyphen appears after the third button clicked. This way, the output better resembles an actual phone number instead of just a string of seven digits.
    Here is an example of the code I currently have assigned to the #2 button on the virtual keypad:
    var text = sym.$("PhoneNum").html();
    text = text + 2;
    sym.$("PhoneNum").html(text);
    PhoneNum is the name of my text box on the stage where the digits appear as each keypad button is clicked.
    In order to incorporate the hyphen after the third button clicked, I need to somehow return the current number of characters in the PhoneNum text box, then create an if/else scenario that applies the hyphen after the third button clicked.
    Does anyone know how I can use either JavaScript or jQuery to return the number of characters currently in the PhoneNum text box?

    No problem!
    Basically the thing to remember is that unless you are needing to pass html to the object, you can use text() instead. text() also gives you the raw text without any html formatting (so you can assume what .html() would return)

  • Display value at the end of timeline range selection

    I need to design Power View Report for which Date will act as "Timeline", so when I select DAte as "2010-10-01" to "2010-11-01" then It should show me report having data on "2010-11-01 because it is latest data value
    that I am having.

    Hi Sandip,
    You could give the following solution a try...
    You will need to add a Date table to your model if you don't have this already. At a minimum this table will have a single date column with all the dates in each year that you have data for in the other table(s) in your model. It's also a best practice to
    mark this as a date table.
    'Date' table
    Date
    01/01/2010
    02/01/2010
    03/01/2010
    04/01/2010
    05/01/2010
    06/01/2010
    07/01/2010
    08/01/2010
    09/01/2010
    10/01/2010
    11/01/2010
    12/01/2010
    13/01/2010
    14/01/2010
    15/01/2010
    16/01/2010
    17/01/2010
    18/01/2010
    19/01/2010
    20/01/2010
    21/01/2010
    22/01/2010
    23/01/2010
    24/01/2010
    25/01/2010
    26/01/2010
    27/01/2010
    28/01/2010
    29/01/2010
    30/01/2010
    etc...
    You could then define a measure that does a basic SUM aggregation for each of the columns that you require a measure for; these are your base measures. In this example, I am only focusing on the Positive column...
    SumOfPositive:=CALCULATE(SUM(Data[Positive]))
    Next, you can define another measure that provides the behaviour that you want, however there are two options for this depending on the exact behaviour required. They look very similar but they are different:
    PositiveLASTDATE:=
    CALCULATE(
    [SumOfPositive],
    LASTDATE('Date'[Date])
    OR
    PositiveLASTNONBLANK:=
    CALCULATE(
    [SumOfPositive],
    LASTNONBLANK(
    'Date'[Date],
    [SumOfPositive]
    The LASTDATE version of the measure will find the last date that you have filter in your range and return the value
    regardless of whether there is data for the date or not. This means that if you select
    "2010-10-01" to "2010-11-01" it will return the result for "2010-11-01" even if there is no data for this date. On the other hand, the LASTNONBLANK version of the measure will find the last date with data.
    This means that if you select "2010-10-01" to "2010-11-01" in this instance, if "2010-10-01"
    is the last date with data then the value for this date will be returned.
    Regards,
    Michael
    Please remember to mark a post that answers your question as an answer...If a post doesn't answer your question but you've found it helpful, please remember to vote it as helpful :)

  • @sum(@range(@list calc

    I am trying to do a calc with the above functions
    I am trying to sum a list of accounts across a multi dimensional list
    So for example if I have Acc1, Acc2, Acc3
    And I'm trying to do this specific for CrossDim1 and CrossDim2
    I wrote is as @sum(@range(CrossDim1->CrossDim2,@list(Acc1,Acc2,Acc3)))
    I needed to do this because I was trying to build a percentage
    CrossDim1->CrossDim2->Acc1/@sum(@range(CrossDim1->CrossDim2,@list(Acc1,Acc2,Acc3))) where there wasn't necessarily an easy node sub-total to get the 3 accounts together.
    The syntax is correct and will run......
    The problem is it never stops. I have tuned this down quite considerable to only be running against what I think is about 400 combinations, through my FIX.
    1) Why does it run forever?
    2) is there a function that is more appropriate
    3) is there some setting at the top level that would make this work correctly (performance setting)
    My cube is quite large 14 dimensions and almost 15G when fully calc'd. I could create another node and make it equal to Acc1 + Acc2 + Acc3 but I have a lot of these so would prefer not to had hundreds of possible sub nodes if possible.

    Period and Accounts are my only dense dimension (12 dimensions are sparse).
    So I'm adding up the members in the @list() that are dense and the cross dimensional items in @range are both sparse and desnse as i cross dimensional on "BegBalance" for my time period and cross dimensional on 2 other dimensions.

  • JavaScript that controls the player does not work

    Hello everyone
    I have a page with an embedded video on Windows media player, and developed a javascript to control the video.
    The parties that control the play, stop, pause, volume, and fast reverse fast forward work very well, but when I put a function that advances the video marks the next and previous does not work in Safari only works in Firefox and the worst and does not accuse me errors simply does not work, then I do not know what to do if someone can help me would greatly appreciate it
    The codes are below
    Code for embedded player
    <div id="Dvideo"  style="position:absolute; width:400px; height:266px; z-index:3; visibility:hidden; left: 14px; top: 85px;">
                    <object 
              id="contentPlayer"
              name="contentPlayer"
              width="400"
              height="266"
              type="application/x-ms-wmp">
                              <param name="AnimationAtStart" value="0" />
                              <param name="AutoStart" value="0" />
                              <param name="CurrentMarker" value="0" />
                              <param name="EnablePositionControls" value="true" />
                              <param name="EnableTracker" value="0" />
                              <param name="ShowAudioControls" value="0" />
                              <param name="ShowCaptioning" value="0" />
                              <param name="ShowControls" value="1" />
                              <param name="ShowDisplay" value="0" />
                              <param name="ShowGotoBar" value="0" />
                              <param name="ShowPositionControls" value="0" />
                              <param name="ShowStatusBar" value="0" />
                              <param name="ShowTracker" value="0" />
                              <PARAM NAME="EnableContextMenu" VALUE="false">
                              <param name="AllowChangeDisplaySize" value="true" />
                              <PARAM NAME="CurrentPosition" VALUE="false">
                              <param name="SRC" value="video.wmv" />
                              <param name="TransparentAtStart" value="1" />
                              <param name="uiMode" value="none"/>
                              <embed
              src="video.wmv"
              width="400"
              height="266"
              autostart="0"
              type="application/x-ms-wmp"
              id="contentPlayer"
              name="contentPlayer"
              showdisplay="0"
              showcontrols="1"
              animationatstart="0"
              transparentatstart="1"
              showstatusbar="0"
              showtracker="0"
              currentmarker="0"
            CurrentPosition="0"
              enablepositioncontrols="true"
              enabletracker="0"
              showcaptioning="0"
              showaudiocontrols="0"
              showgotobar="0"
            EnableContextMenu="false"
            AllowChangeDisplaySize="true"
              uiMode="none"
              showpositioncontrols="0"></embed>
                            </object>
    javascript code
        function play()
                        var player=document.getElementById('contentPlayer');
                             document.getElementById('DInfo').style.visibility = 'hidden'
                        document.getElementById('Dvideo').style.visibility = 'visible'
                        player.controls.play();
        function pause()
                        var player=document.getElementById('contentPlayer');
                      player.controls.pause();
        function stop()
                        var player=document.getElementById('contentPlayer');
                      document.getElementById('DInfo').style.visibility = 'visible'
                        document.getElementById('Dvideo').style.visibility = 'hidden'
                        player.controls.stop();
    function Volume()
              document.getElementById('contentPlayer').settings.volume  = document.getElementById('contentPlayer').settings.volume + 30 ;
    function VolumeDown()
              document.getElementById('contentPlayer').settings.volume  = document.getElementById('contentPlayer').settings.volume - 30 ;
    function mute() {
              var player = document.getElementById('contentPlayer');
              var mutebutton = document.getElementById('bt4');
              if (player.settings.mute) {
              player.settings.mute = false;
              return player.settings.volume + "%";
              mutebutton.src ="../images/mute_false.gif";
              } else {
              player.settings.mute = true;
              return "mute";
              mutebutton.src ="../images/mute_true.gif";
    function fastforward()
              var player=document.getElementById('contentPlayer');
              player.controls.fastForward();
    function fastreverse()
              var player = document.getElementById('contentPlayer');
              player.controls.fastReverse();
    function GoNextMarker (mymark)
              var player = document.getElementById('contentPlayer');
              var mymark = player.controls.currentMarker + 1
              player.controls.currentMarker = mymark;
    function GoPreviusMarker (mymark)
              var player = document.getElementById('contentPlayer');
              var mymark = player.controls.CurrentMarker - 1
              player.controls.currentMarker = mymark;
    </div>

    This has been discussed over and over and over and over and over and over and over and over again.
    Do a forum search (right side of this page) and you will find countless posts on this.

  • Workflow loop, return the work item to the inbox, instead of automatically executing the work item

    Hello all,
    Within a workflow I have a loop. Inside that a foreground step is executed. Then a condition step is executed to decide if the workflow should continue, stop, or return the work item to the inbox.
    This new workflow was modeled after an existing workflow that is doing just that. Unfortunately, this new workflow is not returning the work item to the inbox. Instead, it just keeps displaying the screen that is called by the function module that is called by the business object method that is executed when the foreground task runs.
    I've included a Word document with further detail in a number of screen prints. Hopefully this is something that will experience workflow developer may have seen before and know how to correct.
    Unfortunately I have done very little workflow development and don't have a clue what might be causing this problem.
    Any help would be greatly appreciated.
    Bruce
    I could not attach a Word file, so I added 3 jpg files.  I would have added another 3, but it seems that posts are limited to 3 files.

    Hi Bruce,
    As per your design, If you are approving or returning, the workflow loops back to the step "Approver - stat key approve".
    Suppose you are one of the approver for this step ""Approver - stat key approve" and if you click on approve or return, then it will try to create a new workitem for "Approver - stat key approve" step.
    As you are one of the approver again, the window opens immediately instead of reaching the inbox of all other approvers.
    Include a dummy activity step in the "approve & return" condition outcome.
    Active the workflow & refresh the buffer SWU_OBUF.
    After this, when you click on return it will not open the same screen again. Instead it will be reaching all the approvers' SAP inbox.
    Thanks,
    Karthikeyan

  • How to write a formula in number just like in excel... I simply have not been able to do that ... I am at the point that I think of returning the iPad tomorrow

    Have not been able to write a formula in iPad using the key board rather than the iPad menu... For example I am simply trying the write. =sum(k3:k24).  I cannot do that. Why not?

    Going to return the iPad simply because you didnt read the help pages? Does that mean that you spent that much money to run a single $10 App on it and that was it?
    Look under the wrench icon and tap Help. It has a whole section on how to enter formulas. If your reading this on a desktop or want the web site version of the help section you can folloow this link: http://help.apple.com/numbers/ipad/1.5/ that has it.
    Data and Functions --> Calculations --> insert predefined functions into cells
    Jason

  • Return the User to the Calling Page - doesn't work

    Hello All,
    I set up the "Issue tracker" tutorial to get in tuch with the apex (htmldb vers. 2.0)
    All is working well but: Return the User to the Calling Page -> doesn't work. I performed all steps as descriped in the tutorial (iclusive the '.' on the &P7_PREV_PAGE ;-) ).
    I use my own aplication at home and followed all the instruction steps few times but it does not work. Can you help me please?
    Do I have to install something more?
    In the Branch section: * 1: Go To Page &P7_PREV_PAGE. (Unconditional)
    In the Item section: 90: P7_PREV_PAGE Hidden
    In the Button section for cancel Button: &P7_PREV_PAGE.
    Here is the description of the function in the tutorial:
    Because this Create/Edit page will be called from several places, when users finish with the display they should return to the calling page. To accomplish this, you create an item and change the branch on this page. Every time this page is called, the item must be set with the number of the calling page.
    To create a hidden item:
    1. Under Items, click the Create icon.
    2. For Select Item Type, select Hidden and click Next.
    3. For Display Position and Name:
    1. For Item Name, enter:
    P7_PREV_PAGE
    2. For Region, select Issue Identification.
    3. Click Next.
    4.
    Click Create Item.
    Next, edit the Cancel button.
    5. Under Buttons, select Cancel.
    6. Scroll down to Optional URL Redirect.
    7. In Page, enter:
    &P7_PREV_PAGE.
    Note the period at the end.
    8. Click Apply Changes.
    Next, edit the branch.
    9. Under Action, enter the following in Page:
    &P7_PREV_PAGE.
    10. Click Apply Changes.
    All steps are done but I still got the message: Error ERR-1016 Application "106" Page "0" not found (requested language="de")
    OK
    I move the mousepointer over the cancel button: javascript:redirect('f?p=106:0:5265993428922076876::NO:::')
    Thank you for helping me!
    best regards Thorsten

    All,
    I haven't looked at that tutorial for quite a while but just gave it a quick look.
    Further down in the tutorial, it directs you to set the value of P7_PREV_PAGE, under Add Functionality to Support Adding Multiple Issues Sequentially - have you done that? There is also a mention that there is more branching to be done - "The branch you just created is looking for a value in P7_PREV_PAGE. Since the page was not called from another page, the value has not been set. You need to fix that next." It goes on to have you define that value from other places.
    Can you describe what you are doing when you get the error? There could be something missing from the tutorial. A way around it would be to create a default value for P7_PREV_PAGE so that if it is not set, a default page will be used.
    -- Sharon

  • I just purchased a lightning sd card reader for my iPad, but it does not fit..it's for fourth gen...opps..I've now had to order the camera kit for third gen model...will I need both or do I return the first one

    Hi i just purchased an sd card reader but it's for fourth gen iPad...pops. I've now ordered the camera kit for the third gen ....do I need both somehow or do I just return the lightening ad reader I purchased first. I rang apple support and swear I was told keep both, but if the camera kit is all I need...I don't see the point in keeping the fourth gen one, since it won't fit? Confused...ita a fourteen day refund so I need to act fast...any help?

    There's no reaso to keep the Lightning version if your iPad can't support it. Unless you have some other devcie that can use it, like an iPad Mini or an iPhone 5.
    Otherwise return it.

  • SQL to return the row IDs showing in a Paginated region

    Hi All,
    I am looking for a way to return the RowIDs of the rows that are currently showing in a paginated report Region.
    Preferably with SQL but PL/SQL if required.
    I found this Topic which comes close but is only for one record:
    Re: Connecting a report region and a PL/SQL region
    Any help greatly appreciated.
    If you would like to know why, see my related post here:
    Freeze Panes Functionality
    Thanks again
    Reuben

    Hi All,
    I am looking for a way to return the RowIDs of the rows that are currently showing in a paginated report Region.
    Preferably with SQL but PL/SQL if required.
    I found this Topic which comes close but is only for one record:
    Re: Connecting a report region and a PL/SQL region
    Any help greatly appreciated.
    If you would like to know why, see my related post here:
    Freeze Panes Functionality
    Thanks again
    Reuben

  • Function to return the Entry Value based on Assignment, Element and Date

    Hi Guys,
    Is there a function that returns the Entry Value for the Assignment Element, based on the Assignment Number, Element Name, Entry Segment and the End of Period date?
    Example:
    ==============
    Input Parameters:
    Employee: Iana
    Assignment Num: 123
    Element: D480
    Element Entry: Fund Name
    Output Parameter:
    Element Entry Value: MLC Super Fund
    Thanks,
    Iana

    For element entry values you can use:
    select petf.element_name, nvl(peevf.screen_entry_value,0) screen_entry_value
    from
    pay_element_entries_f peef, pay_element_types_f petf,
    pay_element_entry_values_f peevf, pay_input_values_f pivf,
    per_all_assignments_f paaf
    where petf.element_type_id = peef.element_type_id
    and :p_date_earned between pivf.effective_start_date and pivf.effective_end_date
    and :p_date_earned between petf.effective_start_date and petf.effective_end_date
    and peevf.input_value_id = pivf.input_value_id
    and paaf.assignment_id = peef.assignment_id
    and petf.business_group_id = :p_business_group_id
    and peevf.element_entry_id = peef.element_entry_id
    and :p_date_earned between peef.effective_start_date and peef.effective_end_date
    and :p_date_earned between peevf.effective_start_date and peevf.effective_end_date
    and :p_date_earned between paaf.effective_start_date and paaf.effective_end_date
    and pivf.name = :p_input_value_name
    and petf.element_name = :p_element_name
    and peef.entry_type = 'E'
    and peevf.effective_start_date = peef.effective_start_date
    and peevf.effective_end_date = peef.effective_end_date
    --and peef.assignment_id = :p_assignment_id
    and paaf.assignment_number = :p_assignment_number;
    For payroll results you can use:
    select sum(prrv.result_value)
    from pay_run_results prr, pay_run_result_values prrv,
    pay_assignment_actions paa, pay_payroll_actions ppa,
    pay_element_types_f petf, pay_input_values_f pivf,
    per_all_assignments_f paaf, per_all_people_f papf
    where
    petf.element_type_id = pivf.element_type_id
    and :p_pay_date between petf.effective_start_date and petf.effective_end_date
    and :p_pay_date between pivf.effective_start_date and pivf.effective_end_date
    and paa.assignment_action_id = prr.assignment_action_id
    and petf.element_type_id = prr.element_type_id
    and ppa.payroll_action_id = paa.payroll_action_id
    and prrv.input_value_id = pivf.input_value_id
    and prr.run_result_id = prrv.run_result_id
    and petf.element_name = :p_element_name
    and pivf.name = :p_input_value_name
    and ppa.date_earned = :p_pay_date
    and papf.person_id = paaf.person_id
    and nvl(prr.start_date,ppa.effective_date) between paaf.effective_start_date and paaf.effective_end_date
    and nvl(prr.start_date,ppa.effective_date) between papf.effective_start_date and papf.effective_end_date
    and paaf.assignment_id = paa.assignment_id
    and papf.employee_number = :p_employee_number;

Maybe you are looking for

  • Smart Form printing issue in repeate page

    Hi, We have one smartfforms printing  some notification details in which Only one page layout is use and it is repeated again  at one block Upper margin is 18.23  and Height is 9.60 CM  on first page it is printing properly  but on second page it is

  • Legal Unit and Foreign Trade organization are not in same country

    Hi all, We are currently working on a Maquiladora project under which our plants in Mexico will be assigned to a US company code. However, when we try to define this org structure in GTS, we are getting the below warning message while assigning the L

  • How to I get rid of the autofill alternative (another state, road, etc.) dialog boxes?

    I only have one home. I would like Autofill to fill out forms as I have my information set. I do not want dialog boxes constantly popping up while Autofill is filling out a form, asking me to pick a possible alternative state or road. I have one addr

  • PO message status should change to PROCESSED

    hi   we are taking PO print from ME22N(before releasing it ),  here first we set message then  Goto-->Print Priview-- >Print but problem is that status of Message is not getting changed to processed as it happens in ME9F. how i can get it , we want i

  • Mea Culpa - Internet Explorer now renders my iWeb 2 test site correctly?

    After umpteen server tweaks I finally got my iWeb 2 test site uploaded http://www.mjweber.com/mjwredsite/mjweber/welcome.html It displayed as designed in Safari on my MBP. I then fired up XP in Parallels and loaded the site in Internet Explorer. I di