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

    In my getPage call, I have:
    &where=`{"datestart:>=":"[[!today]]"},{"OR:dateend:>=":"[[!today]]"}`


    But, if `dateend`is empty, I have all results.

    Of course, this code work perfectly:
    &where=`{"datestart:>=":"[[!today]]"}`


    Help!
      • 48696
      • 41 Posts
      Sorry, but in https://docs.modx.com/extras/revo/getpage I didn't find some where property
        • 17301
        • 932 Posts
        You set the element to getResources and you can use the where property with getPage that way.
          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • 17301
          • 932 Posts
          I'm sure someone else can offer a better solution but can you set a default value on dateend to stop it displaying all results in the mean time?
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 37909
            • 153 Posts
            I thought of setting a default value but I have not found how to do with MIGX :/
              • 30585
              • 833 Posts
              How do you set today's date? Can you show the code of the snippet?
                A MODx Fanatic
                • 37909
                • 153 Posts
                Quote from: treigh at Feb 06, 2017, 11:35 AM
                How do you set today's date? Can you show the code of the snippet?
                Which snippet?
                  • 30585
                  • 833 Posts
                  [[!today]]
                    A MODx Fanatic
                    • 37909
                    • 153 Posts
                    Simple
                    <?php
                    return date('Y-m-d H:i:s');
                      • 30585
                      • 833 Posts
                      With the where clause, getResources queries modResource standard object fields. I suspect that your datestart and dateend are TVs, not resource fields. What you need is the tvFilters property or a more complex query using a custom snippet.

                      With &tvFilters you could do this (untested):
                      &tvFilters=`datestart>=[[!today]]%,dateend>=[[!today]]%`


                      Also, I'd advise converting your dates to unix timestamps when comparing against another date. That way you're dealing with numbers instead of strings.
                        A MODx Fanatic