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

    I want to fetch data from the Flickr Api and save them in custom tables. I already created the tables for the photosets and the images.
    I have a snippet to fetch the photosets. I can get the results as array or as json.

    I have no idea how to

    1. show a migx grid by clicking the button export/import for example
    2. put the array/Json from my snippet in this grid
    3. get the choosen rows to save the data in the custom tables (saving with xpdo is clear)

    I have read the how to of "Developing an Extra - Doodles" and the "MIGXdb.Create doodles Tutorial" and much in this forum but I don't know how to get this with migx/migxdb.

    In my case, I have no table with the data. They come from the snippet and should show in the grid and then saved into the table.
    Especially the syntax is difficult for me. I dont know how make the calls, as in the resources, for example [[snippet]] [[+field]] or "snippet" "field". And I couldn't figure out how to diplay the migx grid via the export/import button.

    PS: I can't get the question button an the preview in firefox

    This question has been answered by multiple community members. See the first response.

      • 4172
      • 5,888 Posts
      Do you have a XPDO - schema for your table and did you create the classes and db-table with 'parse schema' allready?

      Can't you import the datas with your or another snippet into your table, then?
      You could, of course, also create a custom-processor and a button within the MIGXdb-CMP to import from Flickr to your custom-table.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37719
        • 9 Posts
        Thank you for reply,

        All tables and classes are already created. My idea was to show and select the photosets before importing them into the tables.

        I thought this is easy possible with migx, but I have no idea how. I wanted to proceed it like this:

        snippet fetches data from FlickrApi as array() or Json -> shows in grid in MigxTV or MIGXdb -> select the photosets -> import in custom tables

        I actually do not need all photosets. I have not imagined that it is so complicated. I thought using the snippet as a grid source, pass my selects by flickrid and fetch the selected photosets including the photos to import.

        I want to use the tables as "mediasource". I think the import/update should always be done via the cmp. The urls of the photos are then saved in the custom table.

        It is so easy to set up grid with colums in migx, I wanted to create this dynamicly with the snippet-output. ;-) [ed. note: toelva__ last edited this post 6 years, 9 months ago.]
          • 37719
          • 9 Posts
          All Tables are filled and I avoided the problem with publish and unpublish of Flickralbums.

          But I have a strange behavier of filtering with MigxLoopCollection and the &where-condition:

          &where=`{"album_id":"72157685712003576","published":"1", "YEAR(datetaken)":"1990"}`


          works. but i am not able to show the result for <1990. I tried:

          "YEAR(datetaken):<":"1990"  "YEAR(datetaken):<":"'1990'"
          "YEAR(datetaken):BETWEEN:1980:AND:":"1990"  "YEAR(datetaken)":"BETWEEN:1980:AND:1990"
          "datetaken":"<631152000"
          "datetaken:<":"631152000"
          "datetaken:<":"'631152000'"


          It is very interesting that >1990 shows pictures. <1990 shows nothing. There are pictures with datetaken <1990 and the SQL-statement:

          SELECT *
          FROM `modx_migx_flickr_images`
          WHERE YEAR( `datetaken` )
          BETWEEN 1980
          AND 1990
          ORDER BY `modx_migx_flickr_images`.`datetaken` DESC 
          
          Zeige Datensätze 0 - 18 ( 19 insgesamt, Die Abfrage dauerte 0.0010 Sekunden) [datetaken: 1986-05-03 13:37:32 - 1981-09-15 10:08:11]
          


          works perfectly

          so how is it possible to show these 18 rows with &where-condition
            • 4172
            • 5,888 Posts
            datetaken is stored in which format? datetime or is it a unixtime - integer?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 37719
              • 9 Posts
              Thanks for the reply,

              the datetaken field is in format datetime.

              I just tested if the &sortConfig is important for the query. But it makes no difference.

              "datetaken:<":"631152000" shows all

              "datetaken:>":"631152000" shows nothing
              • discuss.answer
                • 4172
                • 5,888 Posts
                getting all between 1980 - 1990 should do this:

                &where=`{"datetaken:>=":"1980-01-01 00:00:00","datetaken:<=":"1990-12-31 23:59:59"}`
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                • discuss.answer
                  • 37719
                  • 9 Posts
                  Thanks alot
                  it works now

                  The error usually is in front of the screen.