locked
Advanced Find Limitations RRS feed

  • Question

  • I find the advanced find function easy and useful, but there appear to be limitations, or perhaps limitations in my understanding. 

    I would like to filter lead records between a number of relative dates and Advanced Find allows me to filter on today, tomorrow and yesterday, but not the day before yesterday nor 3 days ago (but not four or two days ago).  When I select the Created On field my closest option is Last X Days, but I would like just the data from two days ago and not yesterday and today which is being returned. 

    Any ideas/tips would be appreciated
    Friday, September 18, 2009 11:39 AM

All replies

  • I think the only option you have is to select "On" or "On or before" in  advanced find. where you have to supplied the exact date.
    something like
    CreatedOn                  On              16/09/2009

    But the limition is that you have to hardcode the date which means the same view will not be usable for next day.
    Friday, September 18, 2009 12:16 PM
  • You can add two select statements and use the filter criteria On or Before for the first Select and On or After for the second or visa versa whichever works for your particular scenario.  This method will allow you to search for a specific range of dates.
    Best Regards, Donna
    Friday, September 18, 2009 1:55 PM
  • Hi you can do one more thing which will require you to register a plugin on the execute message. so do this thing
    1) Create a view with  (Name this view ==> Last 2 Days etc)
             CreatedOn                  On              16/09/2009

    2) Then On execute Message, register a plugin for contact entity that will change the criteria of createdOn (so it doesn't remain fixed 16/09/2009) always.

    public class ContactViewPlugIn : IPlugin
     {
      #region IPlugin Members

      public void Execute(IPluginExecutionContext context)
      {
       if (context.MessageName == "Execute")
       {
        if (context.InputParameters.Properties.Contains("FetchXml"))
        {
         
         XmlDocument indoc = new XmlDocument();
         indoc.LoadXml((string)context.InputParameters["FetchXml"]);               
         //Retrieve name of entity to display               
         string entityName = indoc.SelectSingleNode("//fetch/entity").Attributes["name"].InnerText;
         if (entityName == "contact")
         {
          // change the default date from 16/09/2009 to Current Date - 2 Days
          DateTime lastTwoDays= DateTime.Now.Subtract(new TimeSpan(2, 0, 0, 0));

          XmlNode node = indoc.SelectSingleNode("//fetch/entity//filter//condition");
          if (node != null)
          {
           if (node.Attributes["attribute"] != null && node.Attributes["attribute"].InnerText == "createdon")
           {
            node.Attributes["value"].InnerText = lastTwoDays.ToUniversalTime().ToString("yyyy-MM-dd") + "T00:00:00";
            context.InputParameters["FetchXml"] = indoc.OuterXml;
           }
          }
         }
        }
       }
      }

      #endregion
     }


    Register the Plugin On Execute Message (Entity =None) and PipeLine Stage (Pre).
    This should work !!!

    Friday, September 18, 2009 4:21 PM
  • Hi Donna

    I tried that but found that the selection option for these two criteria were limited to fixed dates, whilst I need relative dates.  There is an Older than X Month option, but that only accepts intergers.  Ideally it would be nice to have old than X days as an option and then I could filter the way you suggest.

    Thanks

    JIm
    Friday, September 18, 2009 5:18 PM
  • Thanks for the advice Muhammad, that code is a bit beyond my skillls, but I can perhaps ask a colleague to help me.

    Regards

    JIm
    Friday, September 18, 2009 5:19 PM
  • Hi Jim,

    If you want dynamic dates, then that is a function of reports.  I suggest you create a custom report that accepts dates as parameters.  I realize that you might have to get some assistance with creating a custom report but that is going to be the right solution.
    Best Regards, Donna
    Friday, September 18, 2009 5:43 PM
  • It seems that an  "older than" option for days is a critical option in the advanced find/query window in order to support goal metrics. Reports would not meet that need.


    KathyTech

    Friday, May 10, 2013 9:10 AM