1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Chained Cascading Dropdown On A Single Table

Discussion in 'Community' started by cypherinfo, Aug 3, 2009.

  1. cypherinfo

    cypherinfo Member

    Level: Community
    Hello,


    I have tried to set a search with three dropdown fields chained as in the classic example is the Country, State, City with no result. All of the fields and value (to be generated for the next dropdown) have to be taken from the same existing table.

    The searches possible have to be of three kind:
    1) the user may select only the country and run the search;
    2) the user may select the country and the state and run the search;
    3) the user may select the: Country, State and City and run the search.

    The point is all of that have to be related to a single existing table.
    I have read the tutorial and many threads about it and no use.

    I know how to set an advanced search on that table with three fields selected in dropdown I do not know yet how to chain those fields as in the Country, State, City example.

    Help me please.

    p.s.: a thread that is identical to mine and I do not seem has an answer is the following: http://fabrikar.com/forums/showthread.php?p=65495#post65495
    :) :-\



    Cypherinfo
     
  2. Bugs Bunny

    Bugs Bunny New Member

    Level: Community
    Hello,

    the example is useful for all of the Fabrik users, it is a very common application.
    After reading the threads on the same issue I realized that when is involved one table only Fabrik is not enough in terms of bugs and features.

    May be it is necessary some PHP coding. Nobody may help?

    Anyway I'm very intersted in this topic cause I need something similar, better if available as a fabrik internal feature.



    Bugs Bunny
     
  3. peamak

    peamak Moderator

    Level: Community
    I really think, as hugh said in the thread given by Cypherinfo, that there's a lot of exemple of how it's done. An important thing will be to run the latest SVN or nightly build as some bug in rc3 may have been corrected.

    Why do you *need* to only use one table for the cascadings? It will be much simpler to do with two (1 for States, 1 for Cities) and I don't actually know if you can do with only one...

    The trick is to have a normal dropdown element as the first dropdown to be watched. So in this case 'Countries', like that:
    value (=id country) - label (=name country)
    1 - Afghanistan
    2 - Etc
    3 - Another one
    4 - Retc
    5 - USA

    And then to make a 1 table 'States' with these elements in the table:

    id_state --- name_state --- id_country
    1 --- New-York --- 5
    2 --- Other State --- 5
    3 --- ThirdOne --- 5
    4 --- StateAnotherCountry --- 2
    5 --- StateAnotherCountry2 --- 2

    And a last one 'Cities':
    id_city --- name_city --- id_state
    1 --- Albany --- 1
    2 --- OtherCityInNY --- 1
    3 --- Other2CityInNY --- 1
    4 --- Other3CityInNY --- 1

    etc... but as I said, with just one table? don't know...
     
  4. cypherinfo

    cypherinfo Member

    Level: Community
    The reason why I have to use one table only is that I have to set a six dropdown field chained, to set before starting the search.

    So I'm concentrating on how to set for three of them and then set for six.

    Thank you indeed for your interest.



    Cypherinfo.
     
  5. Wadi

    Wadi New Member

    Level: Community
    When the play become though... Fabrik bug?

    When it is needed to prepare six chained dropdown on a table only, it has to be changed something in deep.


    Wadi.
     
  6. QfwfQ

    QfwfQ New Member

    Level: Community
    Hi,

    after having read this thread I would expect Fabrik was easy about managing dropdown; as any other DB extension.

    It is certainly a basic feature that has to be easy to set. It is not so for now.

    I expect that will be fixed soon; for it is such a basic feature!

    Bye the way I have to implement that feature in one of my DB and I'm evaluating to keep on using Fabrik or not.

    I trust Rob anyway.


    :)

    QfwQ
     
  7. peamak

    peamak Moderator

    Level: Community
    Well, I disagree about that. What's not easy? Do you mean other DB extension do it like, magically?
    In any case I think you're talking about cascading dropdowns because if you have trouble with normal dropdowns...
    Once you try to set one up (cascading), you just have to understand the logic of it and you obviously have to set up your DB so that cascadings work and know what to display in the observer dropdown. How would it knows it otherwise? ;D

    In any way, if you have any questions, please ask them ;)
     
  8. QfwfQ

    QfwfQ New Member

    Level: Community
    Hello,

    after having read all threads about that topic a question remain without answer: the question in this thread. There is no thread where is explained step by step how to set for a table only, six dropdown field chained for a search.



    QfwfQ
     
  9. peamak

    peamak Moderator

    Level: Community
    Hi!

    With my level of knowledge, I'd say that's simply not possible. But my level of knowledge being what it is, I advise you to wait for hugh's or rob's answer ;) ;)
    You simply would have too many occurrences of the options of the first cascading... And you would have to add a SELECT DISTINCT somewhere in the code, but only for some options and not others... but I may be completely wrong! :/
     
  10. peamak

    peamak Moderator

    Level: Community
    And, also, I still don't get why one would want to only use one table but I guess that's just me :)
     
  11. QfwfQ

    QfwfQ New Member

    Level: Community
    Hello,


    yes you've right focused the situation.

    Too many options to add them manually.




    QfwfQ
     
  12. peamak

    peamak Moderator

    Level: Community
    Indeed, if you want to use it with not too many options you can do it manually but if you use it for example with Continents>Countries>Cities, you would make a CSV file first in Excel based on different files you'd find on the web and then, import the whole thing. That's what I did and it took 10min max.
    If you have to construct yourself the choices, that may be longer but I don't see how it's possible to do it differently (I mean, at some point you have to explain to the system which option goes with what, don't you think?)
     
  13. QfwfQ

    QfwfQ New Member

    Level: Community
    Hello,

    that way many Fabrik users will buy a more intuitive Db extension. I do not think it is so difficult to implement a feature to select from a single table all of the fields will be used as cascading dropdown parameters for a seacrh.

    I'm talking about a big table with thirty fields and thirteen thousand records.

    More if in an hypothetical time in the future I'll need to add one more cascading dropdown I would like to make it easy without coding or importing/exporting all of the table etc..



    QfwfQ
     
  14. peamak

    peamak Moderator

    Level: Community
    I'm trying to wrap my head around such a table (I only use mych simpler table). Can you give an exemple of the fields you have in that table?
    Can you attach a capture of your cascading dropdow settings as well?
     
  15. QfwfQ

    QfwfQ New Member

    Level: Community

    to take it easy think to the country, state, city example where all the fields and data are in the same table.


    QfwrQ
     
  16. peamak

    peamak Moderator

    Level: Community
    I thought about it... it doesn't work if you select state as 'watch element' in the 'Countries' cascading dropdown?
    In other words, can you post a capture of your settings for your first dropdown and following cascading dropdowns? ;D
     
  17. QfwfQ

    QfwfQ New Member

    Level: Community
    Hi,

    it is my first dropdown search I'm building. It is needed a step-by-step approach.


    QfwfQ
     
  18. peamak

    peamak Moderator

    Level: Community
    Well, I did a little bit of that in my post #3 here. Just don't use IDs as I did but the idea is there. If you make a new cascading dropdown, the options are well explained so of course, as any of us, you may still need help (;D) but it's a good thing to actually try some things before ;)
    You'll see, when we're done setting this up it will really look cool!
     
  19. QfwfQ

    QfwfQ New Member

    Level: Community
    Hello,

    the peamak example is with more than one table.


    QfwfQ
     
  20. peamak

    peamak Moderator

    Level: Community
    Just imagine it's the same table...


    USA --- New-York --- Albany
    USA --- New-York --- NYC
    USA --- New-York --- OtherCity
    USA --- Florida --- Miami
    OtherCountry --- FirstSate --- FirstCity
    OtherCountry --- FirstSate --- SecondCity
    OtherCountry --- FirstSate --- ThirdCity
    OtherCountry --- SecondSate --- FirstCityCity
    etc
     

Share This Page