Okay
  Public Ticket #3678300
Array in a Column?
Closed

Comments

  • Faraz started the conversation

    I have data that can have multiple categories in a column. For example, a certain ID can be in USA, Europe, Asia. Another ID is only in USA. How can I store these values so when I filter with USA or Europe, all relevant values are shown?

    Thanks

  •  1,767
    Miloš replied

    Hi Faraz,

    If I understood, you need something like our 'cascade filtering', which is going to take your 'first selected column filter', then the next column filter will 'limit the choises' only to the values which are 'associated' with the previous filter?

    If that is the case, we have a solution with our premium add-on Powerful Filtering.


    Here is a more detailed introduction to this feature :

    If you have two (or more) Columns which can be used for this use-case, then you can achieve it with our Cascade Filtering option.

    Here is an example of how you can configure the Data which will have a "cascade" link between them for Powerful filtering.

    You can see this on our Table #1 in the Powerful filter SandBox Site.

    Here we got the first Column as "Continents", the second Column as "Countries".

    The Continents have repeating rows, so we got multiple Countries for example marked for "Europe" from the first Column.

    5615648160.png
    5874222111.png

    So, if we pick "Europe" in the first "Continent" Filter - then the second Column will limit the choices only to Countries from Europe.

    8311141285.png

    If that makes sense, you can apply the same logic to your Table - if you can construct the Columns in the same way.


    You can check out more about Powerful Filtering options/features on the Documentation hyperlink i sent above;

    as well as to test it out fully on its Sandbox Demo, which i also sent in the text above.


    Let me know if you have any additional questions.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Faraz replied

    No, actually, I mean something for example can belong to multiple categories. So one object can be in USA, UK, Germany, while another can be in USA alone or in UK and Germany. So having multiple categories.

  •  1,767
    Miloš replied

    Hi Faraz,

    My apology, I misunderstood the intended use-case.

    So basically, you wish the filtering logic to 'broaden' the results to show any rows where it matches either of the categories, as you explained, if you search for "Asia", then it should show all relevant rows - when the value belongs to multiple categories like that?

    Basically, this is the default logic how all our filtering works.

    By default, it works like "OR" logic.

    I will give you an example of a use-case like that, where a user had some 'comma separated values' in the same cell and you can then manually configure a dropdown Selectbox/MultiSelectBox or a CheckBox Filter which provide the user to pick one( or more) categories - then the filter will match as "OR" logic.

     AND Logic where the data and the results must match all of the selected examples so, as in the example on the left if you look for “Asia” and “North America”, the results will pull only the rows where both are in the same cell.

    - You can split the values up individually, to use in a filter, even if they are pulled together in the same cell,

    here is an example.

    5678157465.png

    The table pulls the values from all cells, so since you have multiple values together in one cell, it sees it as a unique value.

    What you can do is open this column's settings, go to the Data tab.

     In there, change "Possible values for column" from "Read from table on page load" to "Define values list":

    Then, in the "Values list", manually input the individual values that should be included in this column, and that's it. It should allow you to select each value on the filter, as an individual selection.

    2222083284.png

    ; here is the resulting filter multiselectbox of this example:

    9888788418.png

    So as you said :

    For example, a certain ID can be in USA, Europe, Asia. Another ID is only in USA. How can I store these values so when I filter with USA or Europe, all relevant values are shown?

    You can have a column to store all these 'categories' or 'countries' where an ID belongs to.

    So each row will have a column ID and another column categories/or countries, you can name it anything you wish, of course.

    As the example above, you can store the values in that column like :

    "ID 1"  and the "Countries" can be "Asia, Europe, USA".

    Then anothe row "ID 2" can belong only to "Europe";

    Third row can be "ID 3" and have "Asia" in that column.

    Now, go in the Column data settings, change to "Define value list" and set possible values to the continents you need like :
    Europe, Asia, USA and so on...

    Then set the filter of that column to Selectbox/MultiSelectBox or CheckBox and this should work - in that situation, if a user picked "Europe", the results would be rows 1 and 2 - it would ignore 3rd Row since it only has "Asia" there.



    Let me know how it goes.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables