Thursday, March 11, 2010

Do Select Statement in application engine

Do select always mystify me in application engine . Today I did a small test to understand who it really work . This hands one need a small project in app designer

1. TEST record ( It has three rows)
2.TEST_AET
3.PS_AE Application engine :It will have a Do-Select statement and a subsequent Peoplecode

%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST

Peoplecode :

Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");


A) First I made it reselect .


What would be output : Yes it will go infine because reslect always open a new cursor every time . So after 10 min u will have a huge file and u need to kill the file . Now change the code

%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST
where business_unit <> ' '

Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");
SQLExec(" UPDATE PS_TEST SET BUSINESS_UNIT =' ' ");

I didnot put any exclusive commit and commit level was default . bingo it did work as charm .


B) Made it restartable

%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST

Peoplecode :

Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");

bingo it had only one line , because in restartable it keep same cursor for a long time .

and in last but not least

select fetch ... it is like restartable but no commit work in between ... ,

Monday, March 8, 2010

Cannot Import Package

Hi All

One more new thing for 2day , I tried to import a class but Got an error "

Package not found , but that package was in my class ... After banging on my head on wall for 10 minute I figured out classes are case sensitive ... so used to normal People coding :-)

Sunday, March 7, 2010

Wipping out date from the page

Today I had a small and silly requirement . MY manager asked me to remove date field from page if one of the field is not present . Bingo : I got caught , How to remove the date

1. I tried to be clever and assign "" to date field but it didnot allow me to save the page ..
2. Then tried to assign NULL to the fields , oops so sad page has NULL instead of the blank values .
3. at lease I passed a local variable to assigneed it to my system . bingo it worked like charm ...


Took 15 minute to work it out , got a good feeling from inside :-)