We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33418
    • 22 Posts
    Hi,
    i'm starting with API commands in modx

    i'm trying to extract data from a migx table called "prog_migx" with a snippet.
    my table has multiples lines and four rows called "name", "email", "country", "comment"

    this simple code give me the content of the entire table.
    like this [{"MIGX_id":"1","name":"deroy","email":"[email protected]","country":"ireland","comment":"yep !"},....]
    $page = $modx->getObject('modResource',4);
    $output = $page->getTVValue('prog_migx');
    echo $output;
    


    but now, i want to read a specific row, of a specific line.
    is anybody can help me ?

    thanks.
      • 4172
      • 5,888 Posts
      This is a json-array. There aren't API-functions to filter json-array-items

      MIGX has a method to filter MIGX-items and you can use getImageList.

      for example:

      [[getImageList?
      &tvname=`prog_migx`
      &docid=`4`
      &where=`{"MIGX_id":"4"}`
      ]]


      or

      [[getImageList?
      &tvname=`prog_migx`
      &docid=`4`
      &where=`{"country":"ireland"}`
      ]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!