We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40045
    • 534 Posts
    I have set up a MIGXdb CMP that displays radio shows (class AirplayShows) of a radio station and makes them editable. Each show has a set of record types (identifiers for different airplay records during that show) assigned. The airplay types are stored in a different table (class AirplayTypes) and to connect them together in a many-to-many relationship (many shows can have many types) a connection table has been set up (class AirplayShowType) which consists of the fields (id [pk], typeid [id of AirplayType], showid [id of AirplayShow]).

    I'd like to display a grid of assigned types in a separate formtab inside the edit window of each show. What I have done so far is added the formtab, created a migxdb field with the according config (called like the class, AirplayShowType, joins: [{"alias":"Type"},{"alias":"Show"}]). That works well, the tab shows the grid and ALL the data, e.g. all the connections between shows and types.

    What I tried to achieve (without success obviously =D) now was to only display the types that are assigned to the currently edited show, e.g. something like (in migxdb config AirplayShowType "where" field):

    {"showid":[[+id]]} // thought [[+id]] would be the id of the currently edited show, displays everything
    {"showid":"[[+Show_id]]"} // displays everything
    {"showid":"Show.id"} // displays nothing
    {"showid":Show.id} // displays everything
    {"showid":Show_id} // displays everything
    
    // when I hardcode an ID it works perfectly
    {"showid":1} // displays correctly filtered grid, how can we get that 1 dynamically?
    


    so my question is, how can I get that ID (e.g. "1" in the working getlist where JSON) dynamically from the main migxdb grid?

    thanks for any help!
      • 4172
      • 5,888 Posts
      you can use all scriptProperties as placeholders in the where, or even a snippet.
      https://github.com/Bruno17/MIGX/blob/master/core/components/migx/processors/mgr/default/getlist.php#L113

      {"showid":[[+object_id]]}


      should work

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 51030
        • 1 Posts
        Now that dont works. I add some ad-hoc code to 105 line:
        https://github.com/Bruno17/MIGX/blob/master/core/components/migx/processors/mgr/default/getlist.php#L105

        if($where){
            if (!isset($config['gridfilters'])) {
                $config['gridfilters'] = array();
            }
            $config['gridfilters'][] = array('name'=>'object_id', 'getlistwhere'=>$where);
        }


        after this all works fine. Hope you will fix this on future MIGX version. [ed. note: jonybang last edited this post 11 years, 1 month ago.]