How to capture formulas and support formula evaluation in java web application











up vote
2
down vote

favorite












We have a requirement to incorporate an excel based tool in java web application. This excel tool has set of master data and couple of result outputs using formula calculations on master data.



Master data can be captured in database with relational tables. We are looking for the best way to provide capability to capture, validate and evaluate. formulas.



So far looked at using scripting engines nashorn and provide formula support using eval. We would like to know how people are doing in other places.










share|improve this question


























    up vote
    2
    down vote

    favorite












    We have a requirement to incorporate an excel based tool in java web application. This excel tool has set of master data and couple of result outputs using formula calculations on master data.



    Master data can be captured in database with relational tables. We are looking for the best way to provide capability to capture, validate and evaluate. formulas.



    So far looked at using scripting engines nashorn and provide formula support using eval. We would like to know how people are doing in other places.










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      We have a requirement to incorporate an excel based tool in java web application. This excel tool has set of master data and couple of result outputs using formula calculations on master data.



      Master data can be captured in database with relational tables. We are looking for the best way to provide capability to capture, validate and evaluate. formulas.



      So far looked at using scripting engines nashorn and provide formula support using eval. We would like to know how people are doing in other places.










      share|improve this question













      We have a requirement to incorporate an excel based tool in java web application. This excel tool has set of master data and couple of result outputs using formula calculations on master data.



      Master data can be captured in database with relational tables. We are looking for the best way to provide capability to capture, validate and evaluate. formulas.



      So far looked at using scripting engines nashorn and provide formula support using eval. We would like to know how people are doing in other places.







      java formula






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 17 at 14:37









      sudmong

      1,9991012




      1,9991012
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          I've searched and found two possible libraries that could be useful for you please have a look.



          http://mathparser.org/



          http://mathparser.org/mxparser-hello-world/mxparser-hello-world-java/



          https://lallafa.objecthunter.net/exp4j/



          https://lallafa.objecthunter.net/exp4j/#Evaluating_an_expression_asynchronously






          share|improve this answer

















          • 2




            lallafa.objecthunter.net/exp4j looks nice
            – Teddy
            Nov 17 at 16:19


















          up vote
          0
          down vote













          Depends on how big your data is and what your required SLA is. Also on what kind of formulas/other functions that you want to support.



          For example, consider a function like sum or max. Now, the master data is in some relation table containing 10k rows. You could pull in all this data inside a java app and do a sum (or run any function). However, imagine if the table contained 500K rows. This would take some time to stream all 500K rows to Java app but consumes lot of cpu and network bandwidth (database resources, local cpu resources). A better optimized scenario in that case would be index that column in the database and let database do all the hard work for you.



          Personally, I don't like using eval. I would rather parse the user input to determine what actions to take.



          I am assuming that data is not big to use big data tools.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352229%2fhow-to-capture-formulas-and-support-formula-evaluation-in-java-web-application%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote













            I've searched and found two possible libraries that could be useful for you please have a look.



            http://mathparser.org/



            http://mathparser.org/mxparser-hello-world/mxparser-hello-world-java/



            https://lallafa.objecthunter.net/exp4j/



            https://lallafa.objecthunter.net/exp4j/#Evaluating_an_expression_asynchronously






            share|improve this answer

















            • 2




              lallafa.objecthunter.net/exp4j looks nice
              – Teddy
              Nov 17 at 16:19















            up vote
            3
            down vote













            I've searched and found two possible libraries that could be useful for you please have a look.



            http://mathparser.org/



            http://mathparser.org/mxparser-hello-world/mxparser-hello-world-java/



            https://lallafa.objecthunter.net/exp4j/



            https://lallafa.objecthunter.net/exp4j/#Evaluating_an_expression_asynchronously






            share|improve this answer

















            • 2




              lallafa.objecthunter.net/exp4j looks nice
              – Teddy
              Nov 17 at 16:19













            up vote
            3
            down vote










            up vote
            3
            down vote









            I've searched and found two possible libraries that could be useful for you please have a look.



            http://mathparser.org/



            http://mathparser.org/mxparser-hello-world/mxparser-hello-world-java/



            https://lallafa.objecthunter.net/exp4j/



            https://lallafa.objecthunter.net/exp4j/#Evaluating_an_expression_asynchronously






            share|improve this answer












            I've searched and found two possible libraries that could be useful for you please have a look.



            http://mathparser.org/



            http://mathparser.org/mxparser-hello-world/mxparser-hello-world-java/



            https://lallafa.objecthunter.net/exp4j/



            https://lallafa.objecthunter.net/exp4j/#Evaluating_an_expression_asynchronously







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 17 at 15:25









            Alican Beydemir

            226312




            226312








            • 2




              lallafa.objecthunter.net/exp4j looks nice
              – Teddy
              Nov 17 at 16:19














            • 2




              lallafa.objecthunter.net/exp4j looks nice
              – Teddy
              Nov 17 at 16:19








            2




            2




            lallafa.objecthunter.net/exp4j looks nice
            – Teddy
            Nov 17 at 16:19




            lallafa.objecthunter.net/exp4j looks nice
            – Teddy
            Nov 17 at 16:19












            up vote
            0
            down vote













            Depends on how big your data is and what your required SLA is. Also on what kind of formulas/other functions that you want to support.



            For example, consider a function like sum or max. Now, the master data is in some relation table containing 10k rows. You could pull in all this data inside a java app and do a sum (or run any function). However, imagine if the table contained 500K rows. This would take some time to stream all 500K rows to Java app but consumes lot of cpu and network bandwidth (database resources, local cpu resources). A better optimized scenario in that case would be index that column in the database and let database do all the hard work for you.



            Personally, I don't like using eval. I would rather parse the user input to determine what actions to take.



            I am assuming that data is not big to use big data tools.






            share|improve this answer



























              up vote
              0
              down vote













              Depends on how big your data is and what your required SLA is. Also on what kind of formulas/other functions that you want to support.



              For example, consider a function like sum or max. Now, the master data is in some relation table containing 10k rows. You could pull in all this data inside a java app and do a sum (or run any function). However, imagine if the table contained 500K rows. This would take some time to stream all 500K rows to Java app but consumes lot of cpu and network bandwidth (database resources, local cpu resources). A better optimized scenario in that case would be index that column in the database and let database do all the hard work for you.



              Personally, I don't like using eval. I would rather parse the user input to determine what actions to take.



              I am assuming that data is not big to use big data tools.






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                Depends on how big your data is and what your required SLA is. Also on what kind of formulas/other functions that you want to support.



                For example, consider a function like sum or max. Now, the master data is in some relation table containing 10k rows. You could pull in all this data inside a java app and do a sum (or run any function). However, imagine if the table contained 500K rows. This would take some time to stream all 500K rows to Java app but consumes lot of cpu and network bandwidth (database resources, local cpu resources). A better optimized scenario in that case would be index that column in the database and let database do all the hard work for you.



                Personally, I don't like using eval. I would rather parse the user input to determine what actions to take.



                I am assuming that data is not big to use big data tools.






                share|improve this answer














                Depends on how big your data is and what your required SLA is. Also on what kind of formulas/other functions that you want to support.



                For example, consider a function like sum or max. Now, the master data is in some relation table containing 10k rows. You could pull in all this data inside a java app and do a sum (or run any function). However, imagine if the table contained 500K rows. This would take some time to stream all 500K rows to Java app but consumes lot of cpu and network bandwidth (database resources, local cpu resources). A better optimized scenario in that case would be index that column in the database and let database do all the hard work for you.



                Personally, I don't like using eval. I would rather parse the user input to determine what actions to take.



                I am assuming that data is not big to use big data tools.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 17 at 15:32

























                answered Nov 17 at 15:26









                Vivek Akupatni

                67729




                67729






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352229%2fhow-to-capture-formulas-and-support-formula-evaluation-in-java-web-application%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin