Exchange Rules between javascript and SQL

Mostly I'm looking for ideas. My group’s chances of buying something to solve the problem are incredibly low, but go ahead and offer any commercial products that will help.

The main problem is related to the following scenario:

  • Users enter data into a form that automatically fills in some values ​​based on existing data.
  • This data is saved and everything is fine.
  • A report is created and it is synchronized with the data that has been saved.
  • Now the contents of the database are changed, which determines the automatically populated values.
  • When you open the form, the automatically filled values ​​are changed.
  • Without saving, the report values ​​also need to be updated, but they are not.

Other information:

  • Solving our reporting requires that responses and rule evaluations be obtained from stored procedures or queries in the Oracle database.
  • The form runs in the browser.
  • Based on the autocomplete values, some parts of the form / report will be visible or invisible.

Question: How can I implement a set of rules (stored in a database) in such a way that I can easily evaluate them from both javascript and SQL?

A rule may look like one of the following:

  • If you answered “Yes” to question 1, hide questions 2 through 10.
  • If you answered “No” to question 3, automatically answer “X” to question 4.
  • If question 1 is “Yes,” and question 3 is “No,” and “Question 4” is “Yes,” then run the method “independently.”

, ( javascript sql). , .

, , , , , .

/

, javascript ( , ), / sql, Oracle.

?

+3
5

, , "" , :

Condition: '{Question = "1" and Answer = "Y"} and {Question = "2" and Answer = "N"}',
Action: 'Hide',
Target: '3'

Condition, Action Target , . javascript JSON.

REGEXP_REPLACE PL/SQL Repace (/.../g) javascript, , , . ( javascript , , .)

, , , .

0

JSON.

JSON - :

[
    {
        name: "my_first_rule",
        validation: {
            common: ["required", "[0-9]+"]
            // If you had rules that needed different implementations in .NET
            // vs. Javascript you could set those up as separate attributes here
            // i.e. js: ["some_complex_regex_or_fuction_call"],
            //      net: ["which_needs_to_be_different_in_.NET"]
        },
    {
        name: "my_second_rule",
        validation: {
            common: ["required", "\w+"]
        }
    }
]

javascript back end .aspx ( - , ).

, -, Node.js JScript ( Rhino/Spidermonkey), , ( Silverlight .NET - 56K, , .)

+1

, , , , . Google - , , , ajax , .

0

http://nodejs.org/. Javascript API JS . , , .

0

, :

I understand that some of our users are on older 56 Kbps modems in foreign countries.

If you need responsive and quick action for these users, you need to accept the advance slowness of loading your logic into a JavaScript file and let the client handle it. I would stay away from AJAX because returning to the server a lot with a 56 Kbps modem would not be fun.

0
source

Source: https://habr.com/ru/post/1766830/


All Articles