Thursday, May 20, 2010

To Get the Local/Current PC DateTime not the Server Time using Peoplecode

two ways we can achieve this

1. Using Personalization

%ClientDate:

%ClientDate returns the current date for the current user, adjusted for the user’s time zone. This is the date as specified with the current user's personalizations.You can use this system variable as the default constant for a date field.This is potentially one day different than the server date, which is returned with %Date.

Let's say, the Server is located in US, the business users spread across Global Other than US.

So, if we issue %Date (or any other Date variables) it will return server time.

Suppose if the bussiness user located in India, he should get Date time in IST.



2.Using  DateTimeToTimeZone
 syntax
DateTimeToTimeZone(OldDateTime, SourceTimeZone, DestinationTimeZone)
 
Use the DateTimeToTimeZone function to convert datetimes from the datetime specified by SourceTimeZone to the datetime specified by DestinationTimeZone.

to know the client zone use the variable:- %ClientTimeZone

Eg:- DateTimeToTimeZone(%Datetime, "UST", "IST")
 this will convert US date time to Indian Std Date time.
 
Refer to:-
PeopleBooks: PeopleCode Language Reference 
:-)

Thursday, May 13, 2010

Oralce Instant Client Instructions instead of Oracle Db Client (Using Toad/App Designer)

"To setup Toad with Oracle Client existed in Remote place:


Follow the steps:


1. Install Toad.

2. Download Oracle Instant Client from the following site (64-bit):

    http://www.oracle.com/technetwork/topics/winx64soft-089540.html


3. Place the instant client folder in some directory. Let's C:\Srinivas\InstantClient.

4.Create TNSNAMES.ORA file & place in C:\Srinivas\InstantClient folder.

  Sample TNSNAMES.ORA file:-

      your_dbname=
           (DESCRIPTION =
           (ADDRESS_LIST =
           (ADDRESS = (PROTOCOL = TCP)(HOST = your_db_host_name)(PORT = your_db_port_no))  )
          (CONNECT_DATA =
          (SID = your_dbname)
          (SERVER = DEDICATED)
         )
        )
           
5. Create Environment Variable


       




That's it!!!!!   "

:-)


Monday, May 10, 2010

Sunday, May 9, 2010

Regular Expressions in Oracle 10g

In Oracle Database 10g, you can use both SQL and PL/SQL to implement regular expression support. Regular expressions are a method of describing both simple and complex patterns for searching and manipulating.


To implement regular expression support in either SQL or PL/SQL, you use a new set of functions. These functions are:
Function Name Description
REGEXP_LIKE Similar to the LIKE operator, but performs regular expression matching instead of simple pattern matching
REGEXP_INSTR Searches for a given string for a regular expression pattern and returns the position were the match is found
REGEXP_REPLACE Searches for a regular expression pattern and replaces it with a replacement string
REGEXP_SUBSTR Searches for a regular expression pattern within a given string and returns the matched substring

POSIX Metacharacters in Oracle Database Regular Expressions

Metacharacters are special characters that have a special meaning, such as a wild card character, a repeating character, a nonmatching character, or a range of characters.
You can use several predefined metacharacter symbols in the pattern matching with the functions.
Symbol Description
*
Matches zero or more occurrences
|
Alternation operator for specifying alternative matches
^/$
     
Matches the start of line and the end of line
[]
Bracket expression for a matching list matching any one of the expressions represented in the list
[^exp]
If the caret is inside the bracket, it negates the expression.
{m}
Matches exactly m times
{m,n}
Matches at least m times but no more than n times
[: :]
Specifies a character class and matches any character in that class
\
Can have four different meanings: (1) stand for itself; (2) quote the next character; (3) introduce an operator; (4) do nothing
+
Matches one or more occurrences
?
Matches zero or one occurrence
.
Matches any character in the supported character set (except NULL)
()
Grouping expression (treated as a single subexpression)
\n
Backreference expression
[==]
     
Specifies equivalence classes
[..]
     
Specifies one collation element (such as a multicharacter element)

More on
Oracle

:-)

Wednesday, May 5, 2010

PT8.49 Sending Mail using PT_MCF_MAIL doesn't validate the wrong mail addresses

PT_MCF_MAIL: send() function doesn't validate the wrong mail address'es

import PT_MCF_MAIL:*;

Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail();
------------------------------------------
&email.Recipients = "srinivas@1234.com"; /*mail id syntax is correct but domain(1234.com) is a wrong domain*/
----------------------------------------------
&email.From = "";
&email.BCC = "";
&email.Subject = "Sample";
&email.ReplyTo = "";
&email.ContentType = "text/html";
&res = &email.Send();
WinMessage("Mail Sent " | &res , 0);

I am passing wrong Recipients mail id. when we run this still its &email.Send(); returns 1 (success).. and doesn't capture the %ObEmail_NotDelivered exception.

in Peopletools 8.50 there is a function isDomainNameValid needs to check how this function works..@not at the moment..

from Metalink
---------------
In PT8.50 we have a new function called isdomainavailable to check if the email address's domain is valid or not. It pings DNS server to validate email addresses. Other than that, there is no other ways. Development has stated that Java mail on the outgoing server does not check for invalid address of TO address while sending an email. It just checks for the correct format of email address.
If you consider to upgrade to PT8.50, this issue can be resolved.

:-(

SendMail() vs MCFOutBoundEmail() Emailing Functions

1. Is the MCFOutBoundEmail() function better than SendMail() function?

As of PT 8.49.13, PeopleSoft began using javamail via Multi Channel Framwork (MCF) to send emails, as javamail is fully SMTP Protocol compliant to RFC 821/822. The MCFOutBoundEmail() function is fully compliant, whereas SendMail() function uses PeopleSoft's basesmtp.cpp, and has been found to not be fully compliant with SMTP Protocol RFC 821/822. Therefore, the recommendation is to replace use of SendMail, with MCFOutBoundEmail function.


2. How does this function send email? is it SMTP? Yes, MCFOutBoundEmail sends email fully complant to Simple Mail Transfer Protocol (SMTP)

3. Where is SMTP Server & Port configured? MCFOutBoundEmail() function uses the SMTP section of the Application Server's psappsrv.cfg file, and Process Scheduler's SMTP section of the psprcs.cfg file, just as the SendMail() function does. No special configuration is required for the MCFOutboundEmail() function to work.

--
More on
Oracle Metalink