2 Replies Latest reply: Dec 17, 2012 10:20 PM by 979159 RSS

    How to filter Record in date field

      Hi Guys,

      I have a situation in which i need to filter recoreds based on Date field from a web service.
      Im stucked up in writing filter query here.

      This is my sample code

      QuoteForm.queryType SalesPerson = new QuoteForm.queryType();
      QuoteForm.queryType branch = new QuoteForm.queryType();
      QuoteForm.queryType FiscalYear = new QuoteForm.queryType();

      SListOfOT.recordcountneeded = true;
      SalesPerson.Value = "LIKE '" + Alias + "'";
      Branch.Value = " LIKE '" + stFlag + "'";
      FiscalYear.Value = "LIKE '" + DateTime.Now.ToString("MM/dd/yyyy") + "'";

      rtnListOfOT.stSales_Person= SalesPerson;
      rtnListOfOT.IndexedShortText1 = QFlag;
      rtnListOfOT.dQuotation_Date = FiscalYear;

      dQuotation_date is date field in DB. thw above code throw the following error
      {"Method 'Execute' of business component 'Service Request' (integration component 'Service Request') returned the following error:\n\"The query expression on field 'ZDate_25' is not valid. Please revise and try again.(SBL-DAT-00399)\"(SBL-EAI-04376)"}

        • 1. Re: How to filter Record in date field
          royston goveia
          What Query expression are you trying to use for the Fiscal Year? LIKE '12/17/2012'. Why aren't you using the BETWEEN Operator or the Less than, Greater than Operator?
          • 2. Re: How to filter Record in date field
            Thanks Royston for yr reply.

            My requirement is i need to fetch rcords of current year .
            I need to count the number of quotations raised for that year.
            But in DB i have date field(dquotationdate) but not year field.so for this datefield i need to compare only the year with current year

            select * from quotationtable where year(dquotationdate) = datetime.now.year

            I need my qyery exp to be like this.
            Im stucked here badly.
            Could someone help?