Subject: RE: Expression out of range
Below is my codes…
Function preProcess() As Boolean
On Error Goto oops
crLf = Chr(13) + Chr(10)
ws = urlEncode({<font style="color: red;">})
we = urlEncode({</font>})
errMsg = errMsg & "valError:"
Set s = New notesSession
Set db = s.CurrentDatabase
Set webdoc = s.documentContext
requestContent = webDoc.request_content(0)
custAccountNo = urldecode(Fulltrim(getValue(requestContent, "CustAccountNo", "&")))
Remarks = urldecode(Fulltrim(getValue(requestContent, "Remarks", "&")))
IsRequired = urldecode(Fulltrim(getValue(requestContent, "IsRequired", "&")))
Reasons = urldecode(Fulltrim(getValue(requestContent, "Reasons", "&")))
AmountPropose = urldecode(Fulltrim(getValue(requestContent, "AmountPropose", "&")))
ApplicationNo = urldecode(Fulltrim(getValue(requestContent, "ApplicationNo", "&")))
If Len(Remarks) > 100 Then
Print "content-type: text/html" + crLf
Print {ValError:&Remarks=} & ws & urlEncode("Remarks too long!") & we
preProcess = False
Exit Function
End If
oops:
Dim errStck As New DevCoreErrorStack("preProcess", Err, Error, Erl, "")
Dim errHandler As New DevCoreErrorHandler(errStck)
Error Err, errStck.ToString
Exit Function
End Function
initilize part:
Sub Initialize
On Error Goto oops
If Not preProcess Then
Exit Sub
End If
Call axapta.TTSBEGIN()
Dim cRec As Variant
Dim realcRec As Variant
If Lcase(mode) = "new" Then
Set cRec = New xRecordEd("WebCreditApplication", "", "", "")
Dim s As New notesSession
Dim thisUser As New NotesName(s.EffectiveUserName)
Dim packedNameStr As String
If Len(thisUser.Common) > 50 Then
packedNameStr = Mid(thisUser.common, 1, 48) + ".."
Else
packedNameStr = thisUser.Common
End If
Call cRec.setValue("AppliedBy", packedNameStr)
Call cRec.setValue("AppliedDate", Format(Date,"General Date"))
Else
Set cRec = New xRecordEd("WebCreditApplication", "CreditId", ApplicationNo, "")
End If
Set realcRec =cRec.getRec()
Call cRec.setValue("CustAccount", custAccountNo)
Call cRec.setValue("Remarks", Remarks)
Call cRec.setValue("IsRequired", IsRequired)
Call cRec.setValue("ProposedCredit", AmountPropose)
If mode = "New" Then
Call realcRec.call("insert")
Else
Call realcRec.call("Update")
End If
Call axapta.TTSCommit()
oops:
Call axapta.TTSABORT()
Dim errStck As New DevCoreErrorStack("Initialize", Err, Error, Erl, "")
Call errStck.addExtMsg("custAccountNo", custAccountNo)
Call errStck.addExtMsg("requestContent", requestContent)
Dim errHandler As New DevCoreErrorHandler(errStck)
Call errHandler.WriteToConsole
Call errHandler.WriteToLog("", True)
errMsg = errHandler.getTextForJSAlert
Print "content-type: text/html" +crLf
Print "Failed to Submit."
Print errMsg
Exit Sub
End Sub
Please helping me…