We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    Greetings,

    A little issue ive come accross and havent broached it before.

    I have a functioning MIGx database which outputs fine with Rowboat, however from the MIGxDB i want to pick the values within a MIGx TV to output a selection defined in the TV.

    each Row of the TV would represent a different row in the Database.

    So, if I wanted to show 4 videos I could add 4 items to the TV, and pick from the DB the Video i want on each item.

    So, my MIGXtv is setup like this:

    videoList
    [
    {"caption":"Info", "fields": [
        {"field":"title","caption":"Title"},
        {"field":"video_id","caption":"Video Id","inputTV":"videoSelect"}
    ]}
    ] 


    The videoSelect Tv looks like this


    Type: Dropdown Single Select

    Input Option:

    @EVAL return '--- Choose Item ---'.$modx->runSnippet('Rowboat',array('table'=>'modx_video_db','where'=>'{"published":"1"}','tpl'=>'videoList'));


    videoList tempalte chunk

    ||[[+title]]==[[+id]]


    This generats the title as the dropdown.

    The output of the videoList tv is as follows:

    [{"MIGX_id":"1","title":"DS","video_id":"1"},{"MIGX_id":"2","title":"TF","video_id":"2"}]

    Now, my getImageList call for the TV is as follows:

    [[!getImageList?
        &tvname=`videoList`
        &tpl=`videoListSingle`]]
    


    with the tpl of

    
    [[!Rowboat?
        &table=`modx_video_db`
     &tpl=`VideoItem`
      &where=`{"id":"[[+video_id]]"}`
    
    ]]
    
    


    Id is referenced in the MIGxDb, but I cannot tie the value of the TV to the Rowboat Tpl to get the video Id to output the above rowboat call.

    i've tried using a getter, to get the argument, but obviously this isnt being passed as an argument, and quick frankly im stick on how to tie the two togther.

    Thanks

    Tyr

    EDIT: Seems that after looking back over it after eating im a dunce, so posting incase anyone else comes across the same. neede the LIKE in the JSON


    
    [[!Rowboat?
        &table=`modx_video_db`
     &tpl=`VideoItem`
      &where=`{"id:LIKE":"[[+video_id]]"}`
    
    ]]
    
    




      • 4172
      • 5,888 Posts
      why not something like that to get them all within one query:

      [[getImageList?
      &tvname=`videoList`
      &tpl=`@CODE:[[+video_id]]`
      &outputSeparator=`,`
      &toPlaceholder = `videolist`
      ]]

      [[Rowboat?
      &table=`modx_video_db`
      &tpl=`VideoItem`
      &where=`{"id:IN":[ [[+videolist]] ]}`
      ]]

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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 30912
        • 463 Posts
        Ah thats a good idea actually, although i;ve never been able to get IN to work, I might try that solution - thanks Bruno
          • 4172
          • 5,888 Posts
          If it doesn't work with rowboat, you can try migxLoopCollection
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 30912
            • 463 Posts
            FYI it worked, i was on leave last week.