Tuesday, October 13, 2009

Creating Custom Search for Custom Component

To create a custom search for a customized component, the steps are:

1) Create a search view for the main component.

2) Create a search page and add a page for the new search component. The best way is to make a copy of an already existing search page of delivered component e.g. customer. The reason is, there are work records which are required on the search page.

3) Create the search component and add those pages.

4) Create your own application class in the RB_FILTER application package and your class should extend FilterForm. Some of the basic methods needed in the simplest form are linkTo and addNew in your class apart from the constructor.

5) The grid which will display the search results on the search page should have the following item:

a) A push button/hyperlink e.g. RECORD.FUNCLIB_BO_CDM FIELD.GSRCH_LINK_PB.

b) Peoplecode on the field change event of the field for the pushbutton/hyperlink, which should create a component level object of your class and call the linkTo method in which you will pass the current row.

c) On the search button of the search page (RB_FLT_FORM_WRK.PB_FILTER2) do the same as above.

6) For adding a new record, on the add page, write code for fieldchange event of the Add button (FUNCLIB_BO_CDM.GSRCH_ADD_PB). Call addNew method of the component level object of your class and pass the current row (which contains default values e.g. 'NEXT' for key fields).

7) To transfer from the main component to the search component seamlessly, create an entry in the Component Navigation component. Create a local object of RB_CDM:RB_CDM_UTILITIES:ConfiguredTransfer class in searchInit event of the search record of your main component using the transactionId of the row created in the Component Navigation. Call the doTransfer method of the object. The effect is: When the user clicks Return to Search on the main component, it will take him/her to the search component search page.

8) Create a row in the Configurable Search setup in Setup CRM-> Common Definitions.


P.S. The search record for the search component should be Installation record.



Tuesday, August 18, 2009

"If" by Rudyard Kipling.

If you can keep your head when all about you
Are losing theirs and blaming it on you,
If you can trust yourself when all men doubt you,
But make allowance for their doubting too;
If you can wait and not be tired by waiting,
Or being lied about, don't deal in lies,
Or being hated, don't give way to hating,
And yet don't look too good, nor talk too wise:

If you can dream - and not make dreams your master,
If you can think - and not make thoughts your aim;
If you can meet with Triumph and Disaster
And treat those two impostors just the same;
If you can bear to hear the truth you've spoken
Twisted by knaves to make a trap for fools,
Or watch the things you gave your life to, broken,
And stoop and build 'em up with worn-out tools:

If you can make one heap of all your winnings
And risk it all on one turn of pitch-and-toss,
And lose, and start again at your beginnings
And never breath a word about your loss;
If you can force your heart and nerve and sinew
To serve your turn long after they are gone,
And so hold on when there is nothing in you
Except the Will which says to them: "Hold on!"

If you can talk with crowds and keep your virtue,
Or walk with kings - nor lose the common touch,
If neither foes nor loving friends can hurt you,
If all men count with you, but none too much;
If you can fill the unforgiving minute
With sixty seconds' worth of distance run,
Yours is the Earth and everything that's in it,
And - which is more - you'll be a Man, my son!

Rudyard Kipling (1865-1936)

-- My fav poem. I studied it in school. :)

Thursday, March 5, 2009

Hibernate Notes - 1

Random notes on Hibernate:

Some important objects of Hibernate:
1) SessionFactory: Threadsafe/immutable cache of compiled mappings to a single database. For each database there is one SessionFactory object. It's a factory of sessions and client of ConnectionProvider. Holds optional secondary-level cache of objects.

2) Session: Single threaded, short lived object. Factory of Transactions. Wraps up JDBC Connection. Holds mandatory first-level cache of objects.

3) Transaction: Single threaded, short lived object. Represents atomic units of work. A session might span multiple Transactions.


State of Instance objects:
1) Persistent: Object is associated with a persistent context. It has a persistence identity(primary key). Hibernate guarantees that the persistent identity is equivalent to the java identity.

2) Detached: Object was once associated with persistence context, however the context is closed. Hibernate makes no guarantee about the relationship between the persistent context and java context.
3) Transient: Object is not and never has been associated with persistence context. Has no persistent identity(primary key value).

Thursday, February 19, 2009

Subtracting DateTime values in PS Query

In PS Query, DateTime (e.g. BEGINDTTM) field is changed to the TO_CHAR(A.BEGINDTTM,'YYYY-MM-DD-HH24.MI.SS."000000"') .

To subtract a DateTime field from another Datetime field, following expression should be created:

TO_DATE(SUBSTR(A.ENDDTTM,1,16),'YYYY-MM-DD-HH24.MI') - TO_DATE(SUBSTR(A.BEGINDTTM,1,16),'YYYY-MM-DD-HH24.MI')


The sql of the query would be:

SELECT TO_CHAR(A.BEGINDTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.ENDDTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_DATE(SUBSTR( TO_CHAR(A.ENDDTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI') - TO_DATE(SUBSTR( TO_CHAR(A.BEGINDTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI')
FROM PS_PMN_PRCSLIST A



Hope this is helpful.

Cheers.

Friday, January 23, 2009

Curse of Intelligence

The Curse of intelligent and just is that he has to act just fully towards whom he loves.