Here are a couple of sample for VBScript.
This one calculates a date 90 days in advance of today and stores it in a field in my form so I can use it to find data that is within 90 days. You could make the amount 10 instead. If you go to tools and form options you can select whether you will use Java Script or VB Script.
Then Tools -> programing -> On Load Event then you could paste in the line starting with XDocument. You would need to modify the field description to match your particular schema.
Sub XDocument_OnLoad(eventObj)
XDocument.DOM.selectSingleNode("//dfs:myFields/my:Header/my:Variable").text = DateAdd("d",90,date)
End Sub
This one is used to subtract 90 days from a date that has been entered by the user to set a start date for some workflow.
This has been added to a button.
Sub CTRL266_OnClick(eventObj)
Dim job
Dim action
Dim SDate
Dim nNode
Dim flag
Dim selectflag
Dim formatDate
Dim month
Dim day
Dim calcDate
Dim newDate
flag = "Manage"
Set job = XDocument.DOM.selectNodes("//dfs:myFields/dfs:dataFields/d:WFPJob")
job.reset()
Set nNode = job.nextNode()
While Not(nNode Is Nothing)
selectflag = nNode.selectSingleNode("@SelectFlag").text
If flag = selectflag Then
SDate = nNode.selectSingleNode("@SDate").text
End IF
Set nNode = job.nextNode()
WEnd
Trim(SDate)
formatDate = DateSerial(Mid(SDate, 1, 4), Mid(SDate, 6, 2), Mid(SDate, 9, 2))
calcDate = DateAdd("d",-90,formatDate)
month = DatePart("M", calcDate)
If Len(month) = 1 Then
month= "0" & month
End If
day = DatePart("D", calcDate)
If Len(day) = 1 Then
day = "0" & day
End If
newDate = DatePart("YYYY", calcDate) & "-" & month & "-" & day
Set action = XDocument.DOM.selectNodes("//dfs:myFields/dfs:dataFields/d:WFPJob/d:WFPAction")
action.reset()
Set nNode = action.nextNode()
While Not(nNode Is Nothing)
selectflag =nNode.selectSingleNode("@SelectFlag").text
If flag = selectflag Then
nNode.selectSingleNode("@ActionDate").text = newDate
End IF
Set nNode = action.nextNode()
WEnd
End Sub
I would do some research on DateAdd and DateDiff for VB if you need to do more.