Correct Syntax for pulling dynamic date range - InfoPath Dev
in

InfoPath Dev

Correct Syntax for pulling dynamic date range

Last post 01-08-2013 02:13 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-08-2013 07:35 AM

    Correct Syntax for pulling dynamic date range

    I need to modify the following statement to only return rows from a SQL database where the "closed date" has been within the past 12 months (moving target since the query could be run at anytime during the year).  What is the correct syntax to handle this? 

    concat("ModifySqlQuery /dsname=ByteproAGS /where=where Status.ClosedDate is not null and Loan.LoanWith is not null and Borrower.SSN='", SSN, "'")

     Thanks.

  • 01-08-2013 07:47 AM In reply to

    Re: Correct Syntax for pulling dynamic date range

    You'd use a concat and some formulas for getting the correct range values - what version of SQL are you on? If 2005 or later, you can use BETWEEN otherwise you'd need ClosedDate < ... and ClosedDate > ....

    Do the values in ClosedDate include time?

    Hilary Stoupa

  • 01-08-2013 12:33 PM In reply to

    Re: Correct Syntax for pulling dynamic date range

    I'm using SQL 2008.  It isn't time specific. 

    What I'm needing in other words is, if at any given moment the query is run, if it is 356 days or less from the "closed date" value to now(), pull the result.  I'm new to this language so please forgive me.

  • 01-08-2013 02:13 PM In reply to

    Re: Correct Syntax for pulling dynamic date range

    I'm thinking you'll need to combine BETWEEN w/ addDays - something like:

    concat("ModifySqlQuery /dsname=ByteproAGS /where=where Status.ClosedDate between '",  addDays(today(), -365),  "' and '", today(), "' and Loan.LoanWith is not null and Borrower.SSN='", SSN, "'")

    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.