mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.68k stars 552 forks source link

How to get the All Data values from Rules ? is there any default functionalities is there ? #914

Closed godofblack closed 3 years ago

godofblack commented 3 years ago

I want to get all values as an array ["registration","registration", "registration", "workexperience_details","workexperience_details"] from the "data" key of the rules below:

{
  "condition": "AND",
  "rules": [
    {
      "id": "full_name",
      "field": "full_name",
      "type": "string",
      "input": "text",
      "operator": "is_null",
      "value": null,
      "data": {
        "table": "registration"
      }
    },
    {
      "id": "post",
      "field": "post",
      "type": "string",
      "input": "text",
      "operator": "equal",
      "value": "600001",
      "data": {
        "table": "registration"
      }
    },
    {
      "condition": "AND",
      "rules": [
        {
          "id": "state",
          "field": "state",
          "type": "string",
          "input": "text",
          "operator": "equal",
          "value": "TN",
          "data": {
            "table": "registration"
          }
        },
        {
          "id": "natureofdutiesperformed4",
          "field": "natureofdutiesperformed4",
          "type": "string",
          "input": "text",
          "operator": "equal",
          "value": "299",
          "data": {
            "table": "workexperience_details"
          }
        },
        {
          "condition": "AND",
          "rules": [
            {
              "id": "exptyr7",
              "field": "exptyr7",
              "type": "date",
              "input": "text",
              "operator": "equal",
              "value": "2021/05/24",
              "data": {
                "table": "workexperience_details"
              }
            }
          ]
        }
      ]
    }
  ]
}

Is this possible ?

mistic100 commented 3 years ago

There is no buildin function to do that. not complicated to do it yourself with a recursive function