Application designer tips - Part1

来源:互联网 发布:个性字体软件下载 编辑:程序博客网 时间:2024/05/16 18:21

Application designer tips - Part1

 

Please Sign In or Register to like this blog.

 

Display Control and Related Fields:
Always keep display control and related fields in interactive mode, it gives user a chance to review the related details on fieldchange. Otherwise user can see related values only after save.

Field Level Validations:
If you have to do validation on change of the value of a field and show error/warning based on that, always use FieldEdit as it highlights the field and does not allow user to proceed without correcting the same.

Validations on SavePreChange:
Never use SavePreChange for validations, otherwise any error caused on SavePreChange will force user to start over again (i.e. user will not be able to correct the error on SavePreChange, he has to initialize the component again). Instead we should use SaveEdit for validations and save time error messages.

Display only Fields on Grid:
If you check the property display only of a grid, all the fields on grid become display only. opposite of the same is also true i.e. If you have some fields on grid and all of them are display only, then your grid will also become display only irrespective of display only property of grid whether it is checked or not

Something About RowInsert and Rowdelete:

1.

In rowinsert action in a grid on page RowInsert, FieldDefault, FieldFormula and RowInit events are executed in sequence.

2.

In Rowinsert first a row is inserted in data buffer then any peoplecode written on RowInsert is Fired.

3.

In RowDelete at first any peoplecode written on rowdelete is executed then that row is removed from data buffer.

4.

It will give peoplecode error if we write insert method in RowInsert or delete method in Rowdelete event for the same rowset.

 

Display Control and Related Fields:
Always keep display control and related fields in interactive mode, it gives user a chance to review the related details on fieldchange. Otherwise user can see related values only after save.

Field Level Validations:
If you have to do validation on change of the value of a field and show error/warning based on that, always use FieldEdit as it highlights the field and does not allow user to proceed without correcting the same.

Validations on SavePreChange:
Never use SavePreChange for validations, otherwise any error caused on SavePreChange will force user to start over again (i.e. user will not be able to correct the error on SavePreChange, he has to initialize the component again). Instead we should use SaveEdit for validations and save time error messages.

Display only Fields on Grid:
If you check the property display only of a grid, all the fields on grid become display only. opposite of the same is also true i.e. If you have some fields on grid and all of them are display only, then your grid will also become display only irrespective of display only property of grid whether it is checked or not

Something About RowInsert and Rowdelete:

1.

In rowinsert action in a grid on page RowInsert, FieldDefault, FieldFormula and RowInit events are executed in sequence.

2.

In Rowinsert first a row is inserted in data buffer then any peoplecode written on RowInsert is Fired.

3.

In RowDelete at first any peoplecode written on rowdelete is executed then that row is removed from data buffer.

4.

It will give peoplecode error if we write insert method in RowInsert or delete method in Rowdelete event for the same rowset.

 

 

 

 

Peoplecode Tips and Tricks - Part2

 

 

 

1. Set component changed page field property:

For understanding this open a page in application designer and in the field property of one of the edit field uncheck the propertySet component Changed and save the page. Now go on the online page, make some changes in field value and save the page.

What do you think will happen with that field value?

Open online page again and you will find that field value is not changed. Why?
Because Set component Changed property of field helps component buffer to check whether any change in that value has happened. If this property is unchecked any change in the field is ignored and that field in component buffer stays unchanged.

2. Disable saving page component property:

In component properties under Use tab there is a property checkbox named Disable saving page. After we check this checkbox, the save toolbar button in component properties under internet is automatically disabled, i.e delivered save button functionality can not be used after that. This property is very useful in removing that annoying error on page when we move out of the component without saving which saysYou have unsaved data on the page. Click OK to go back and save or click Cancel to continue without saving.

Don't worry still you can use DoSave() and DoSaveNow() functions using peoplecode to save the data in component.

This property has following significance:

1.       To remove the unsaved data prompt while moving away from component without saving.

2.       To disable the delivered save but we can use other toolbar buttons.


3. Search Edit Record field property for Search keys:

In record field properties when we select Search key option, Search edit is enabled to be selected.

Actually SetSearchEdit() function is for limiting the user search to '=' and to 'IN' operators.

e.g. if you want to search the data of Employee ID '12345' so on the search page you have to enter the whole Employee ID '12345'.
If you will think that after entering only '123' in search field will enlist all the employee IDs starting with '123', search edit set on employee ID will prevent this from happening and search will give some error.

So now your search is limited to '=' or 'IN' only as:
EMPLID = '12345'
or
EMPLID IN ('12345')

If you want to remove search edit from some field, simply use function ClearSearchEdit() on SearchInit for this. Or for enabling search edit, use function SetSearchEdit().

4. DiscardRow() and StopFetching() peoplecode functions:

DiscardRow() and StopFetching() are the delivered peoplecode functions which can only be used in RowSelect event.

DiscardRow is not to select a particular row based on some certain condition but continues with the next row in RowSelect.

But unlike the DiscardRow, StopFetching stops the execution of RowSelect based on some certain condition which we provide in peopleode on RowSelect event. From the definition of StopFetching function, we can understand that it acts like and error in RowSelect event.

5. Accessing the related display field in grid on peoplesoft pages:

There could be chances that we are required to access the related display field on grid. If there is only one record field as related display then its fine, no problem there. But it is complicated when there are multiple related displays from the same record fields.

Let us say that in one of the grid we want to show the names for JOB.SUPERVISOR_ID and JOB.EMPLID and these fields are display control fields and related fields for both is PERSON_NAME.NAME so referencing the related field of JOB.SUPERVISOR_ID will be an issue with the grid referencing syntax as it will reference the related field of JOB.EMPLID also.

Now here is the syntax for the same:

Let row of that field is &Grid_Row

Now accessing the related field of JOB.SUPERVISOR_ID:
&Grid_Row. JOB.SUPERVISOR_ID.GetRelated (PERSON_NAME.NAME).value;

Now accessing the related field of JOB.EMPLID:
&Grid_Row. JOB.EMPLID.GetRelated (PERSON_NAME.NAME).value