dateParm
mpine@clearbal…
Forums
Hi,
I am attempting to create two "dateParm"s without having to actually type both in an input box. DateParm will be an inputbox (example, i type in "20181127")
DateParm1 should always be 4 days prior to "dateParm" . How can i create a custom formula to make DateParm1 = dateParm - 4 days.
Sub Main
IgnoreWarning(True) Client.CloseAll dateParm = InputBox ("Enter Date String (YYYYMMDD): ") dateParm1 = dateParm - 4
Hi there,
Hi there,
In IDEAScript there is an interesting trick, all the @ functions avialable in the Equation Editor are also available in IDEAScript by changing the @ for an i. The only downside is it only works for @ functions available prior to IDEA V9 but fortunately that is most of them. So for your question you can use the @DaysToD and @DtoDays to change the date to a number, subtract 4 days and then change it back to a date. Here is some sample code for you:
Sub Main
Dim dateParm1 As String
Dim dateParm2 As String
dateParm1 = InputBox ("Enter Date String (YYYYMMDD): ")
dateParm2 = iDToDays(dateParm1) - 4
dateParm2 = iDaysToD(dateParm2 )
MsgBox "Entered date: " & dateParm1
MsgBox "Date 4 days earlier: " & dateParm2
End Sub