READ TRACE as described below.
PSAPPSRV.1033 1-525 16.50.10 0.000 Cur#1.CRMDEV1 RC=0 Dur=0.000 COM Stmt=SELECT
"1-525" >>>sequential line counter for the process.
"16.50.10" >>>time stamp
"0.000" >>>time elapsed since the previous line was written to the trace file.
"Cur#1" >>> number of the cursor for the statement
"CRMDEV1" >>>name of the instance in which the statement was executed.
"RC=0" >>> Return Code
"Dur=0.000">>>duration of the statement.
.
Monday, March 19, 2012
Saturday, May 28, 2011
PEOPLECODE HELP BITS 4
Function Delay(&seconds As number, &BoId As number) Returns boolean;
;
&jCls = GetJavaClass("java.lang.Thread");
&WaitTill = AddToDateTime(%Datetime, 0, 0, 0, 0, 0, &seconds);
While &WaitTill > %Datetime
/*Check every one Second time*/
SQLExec("Select count(*) from Table ABC where COL= :1", &id, &IdCheck);
If &IdCheck> 0 Then
Return True;
Else
GetJavaClass("java.lang.Thread").sleep(2000); /*Sleep takes Millis.2000 millis equals 2 seconds*/
End-If;
End-While;
Return False;
End-Function;
;
&jCls = GetJavaClass("java.lang.Thread");
&WaitTill = AddToDateTime(%Datetime, 0, 0, 0, 0, 0, &seconds);
While &WaitTill > %Datetime
/*Check every one Second time*/
SQLExec("Select count(*) from Table ABC where COL= :1", &id, &IdCheck);
If &IdCheck> 0 Then
Return True;
Else
GetJavaClass("java.lang.Thread").sleep(2000); /*Sleep takes Millis.2000 millis equals 2 seconds*/
End-If;
End-While;
Return False;
End-Function;
Friday, March 25, 2011
PeopleCode Help Bits 3
If you need to Validate Email Address Fields for Strange inputs, here is the one that helps.
method ValidateEmailAddress
/+ &email as String +/
/+ Returns String +/
Local number &nReason, &k;
/*Check for Strange Chars.~ ! @ # $ % ^ & * ( ) + { } | < > ? : " / ` = ; ' , [ ] \*/
Local array of string &astrEmailChecker = %This.buildCheckArray();
For &k = 1 To &astrEmailChecker.Len;
If Find(&email, &astrEmailChecker [&k]) = 0 Then
Return &astrEmailChecker [&k];
End-If;
End-For;
/*check for numbers in the predomain string e.g predomain@domain.com*/
Local number &nATPos = Find("@", &email);
Local string &sEmlPre@ = Substring(&email, 1, &nATPos - 1);
/*Check for all numbers*/
If IsDigits(&sEmlPre@) Then
/* do error processing */
Return "Digits in email before @ sign."
Else
/* do processing */
End-If;
/*check for Dot*/
Local string &sEmailDomain = Substring(&email, &nATPos + 1, Len(&email));
Local number &nPeriodPos = Find(".", &sEmailDomain, 2);
Local string &sEmlPost@ = Substring(&sEmailDomain, 1, &nPeriodPos - 1);
If &nATPos = 0 Then
Return "Email do not contain @ sign in the email.";
End-If;
If &nATPos = 0 Or
&nPeriodPos = 0 Then
Return "Email do not contain . after @ sign in the email.";
End-If;
If IsDigits(&sEmlPost@) Then
/* do error processing */
Return "Digits in email after @ sign and before dot.";
Else
/* do processing */
End-If;
Return "OK";
end-method;
method buildCheckArray
/+ Returns Array of String +/
Local array of string &astrEmail = CreateArrayRept("", 0);
&astrEmail.Push("~");
&astrEmail.Push("!");
&astrEmail.Push("@");
&astrEmail.Push("#");
&astrEmail.Push("$");
&astrEmail.Push("%");
&astrEmail.Push("^");
&astrEmail.Push("&");
&astrEmail.Push("*");
&astrEmail.Push("(");
&astrEmail.Push(")");
&astrEmail.Push("+");
&astrEmail.Push("{");
&astrEmail.Push("}");
&astrEmail.Push("|");
&astrEmail.Push("<");
&astrEmail.Push(">");
&astrEmail.Push("?");
&astrEmail.Push(":");
&astrEmail.Push("""");
&astrEmail.Push("/");
&astrEmail.Push("`");
&astrEmail.Push("=");
&astrEmail.Push(";");
&astrEmail.Push("'");
&astrEmail.Push(",");
&astrEmail.Push("[");
&astrEmail.Push("]");
&astrEmail.Push("\");
Return &astrEmail;
end-method;
method ValidateEmailAddress
/+ &email as String +/
/+ Returns String +/
Local number &nReason, &k;
/*Check for Strange Chars.~ ! @ # $ % ^ & * ( ) + { } | < > ? : " / ` = ; ' , [ ] \*/
Local array of string &astrEmailChecker = %This.buildCheckArray();
For &k = 1 To &astrEmailChecker.Len;
If Find(&email, &astrEmailChecker [&k]) = 0 Then
Return &astrEmailChecker [&k];
End-If;
End-For;
/*check for numbers in the predomain string e.g predomain@domain.com*/
Local number &nATPos = Find("@", &email);
Local string &sEmlPre@ = Substring(&email, 1, &nATPos - 1);
/*Check for all numbers*/
If IsDigits(&sEmlPre@) Then
/* do error processing */
Return "Digits in email before @ sign."
Else
/* do processing */
End-If;
/*check for Dot*/
Local string &sEmailDomain = Substring(&email, &nATPos + 1, Len(&email));
Local number &nPeriodPos = Find(".", &sEmailDomain, 2);
Local string &sEmlPost@ = Substring(&sEmailDomain, 1, &nPeriodPos - 1);
If &nATPos = 0 Then
Return "Email do not contain @ sign in the email.";
End-If;
If &nATPos = 0 Or
&nPeriodPos = 0 Then
Return "Email do not contain . after @ sign in the email.";
End-If;
If IsDigits(&sEmlPost@) Then
/* do error processing */
Return "Digits in email after @ sign and before dot.";
Else
/* do processing */
End-If;
Return "OK";
end-method;
method buildCheckArray
/+ Returns Array of String +/
Local array of string &astrEmail = CreateArrayRept("", 0);
&astrEmail.Push("~");
&astrEmail.Push("!");
&astrEmail.Push("@");
&astrEmail.Push("#");
&astrEmail.Push("$");
&astrEmail.Push("%");
&astrEmail.Push("^");
&astrEmail.Push("&");
&astrEmail.Push("*");
&astrEmail.Push("(");
&astrEmail.Push(")");
&astrEmail.Push("+");
&astrEmail.Push("{");
&astrEmail.Push("}");
&astrEmail.Push("|");
&astrEmail.Push("<");
&astrEmail.Push(">");
&astrEmail.Push("?");
&astrEmail.Push(":");
&astrEmail.Push("""");
&astrEmail.Push("/");
&astrEmail.Push("`");
&astrEmail.Push("=");
&astrEmail.Push(";");
&astrEmail.Push("'");
&astrEmail.Push(",");
&astrEmail.Push("[");
&astrEmail.Push("]");
&astrEmail.Push("\");
Return &astrEmail;
end-method;
Subscribe to:
Posts (Atom)