Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Return negative number as 0

Return negative number as 0

Scheduled Pinned Locked Moved Java
csshelp
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    and180y
    wrote on last edited by
    #1

    Hi, first time posting so hopefully doing it correctly. I have used a form builder to build my forms but have run into a couple of issues with functionality. In the code/calculation below I need to be able to return the answer 0 if the answer is less than 0. I've searched loads to no avail so any help would be much appreciated. T.I.A.

    $('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0==0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});

    L 1 Reply Last reply
    0
    • A and180y

      Hi, first time posting so hopefully doing it correctly. I have used a form builder to build my forms but have run into a couple of issues with functionality. In the code/calculation below I need to be able to return the answer 0 if the answer is less than 0. I've searched loads to no avail so any help would be much appreciated. T.I.A.

      $('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0==0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression Nett_Earnings -Actual_Takings >0==0, what is >0==0 supposed to mean?

      A 2 Replies Last reply
      0
      • L Lost User

        What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression Nett_Earnings -Actual_Takings >0==0, what is >0==0 supposed to mean?

        A Offline
        A Offline
        and180y
        wrote on last edited by
        #3

        Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.

        L A 2 Replies Last reply
        0
        • L Lost User

          What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression Nett_Earnings -Actual_Takings >0==0, what is >0==0 supposed to mean?

          A Offline
          A Offline
          and180y
          wrote on last edited by
          #4

          I have also tried it this way

          $('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0?0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});

          however that then means no output to the box at all.

          Richard DeemingR 1 Reply Last reply
          0
          • A and180y

            Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            What is this code and where did you get it from? As I said it does not look anything like Java.

            A 1 Reply Last reply
            0
            • L Lost User

              What is this code and where did you get it from? As I said it does not look anything like Java.

              A Offline
              A Offline
              and180y
              wrote on last edited by
              #6

              Thanks for answering. The programme is called simfatic form maker. This was their reply to my query "Simfatic Forms calculation field can't handle multiple levels of variables. In this case, the user enters a variable that intern is a variable in the next step. This form has to be hand coded with the help of a developer" Here is the actual form I am trying to make work https://www.salonlogic.co.uk/forms/Commission/Commission.php[^]

              L 1 Reply Last reply
              0
              • A and180y

                Thanks for answering. The programme is called simfatic form maker. This was their reply to my query "Simfatic Forms calculation field can't handle multiple levels of variables. In this case, the user enters a variable that intern is a variable in the next step. This form has to be hand coded with the help of a developer" Here is the actual form I am trying to make work https://www.salonlogic.co.uk/forms/Commission/Commission.php[^]

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Sorry, but this has nothing to do with Java programming. You need to talk to the people who created this package for information.

                1 Reply Last reply
                0
                • A and180y

                  I have also tried it this way

                  $('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0?0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});

                  however that then means no output to the box at all.

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #8

                  That is not Java; that is JavaScript. Despite the similar names, they are two completely different languages. There is a specific forum for JavaScript questions: JavaScript Discussion Boards[^]


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  A 1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    That is not Java; that is JavaScript. Despite the similar names, they are two completely different languages. There is a specific forum for JavaScript questions: JavaScript Discussion Boards[^]


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    A Offline
                    A Offline
                    and180y
                    wrote on last edited by
                    #9

                    Thanks for replying, I will ask in the correct place. :)

                    1 Reply Last reply
                    0
                    • A and180y

                      Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.

                      A Offline
                      A Offline
                      athenna
                      wrote on last edited by
                      #10

                      Wow, marvelous blog format! How lengthy have you ever been blogging for? you make running a blog look easy. The entire look of your website is excellent, let alone the content! Also visit my web page - thevipweb.com[^]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups