How to Declare a Function in PeopleCode

Your rating: None Average: 3.1 (13 votes)

Declaring a function using PeopleCode is pretty straight forward and this is how you can do that:

Declare Function GetUserDescr PeopleCode FUNCLIB_PTSEC.OPRID FieldFormula;

GetUserDescr
is the function name you want to declare. FUNCLIB_PTSEC is the record where the function has been stored, and OPRID is the field the function is under, and finally FieldFormula is where the function is located within the “OPRID” field.

Hope this was helpful!

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
shaffy's picture
shaffy (not verified)
Re: How to Declare a Function in PeopleCode

Good Post

sivasankar.nbl's picture
sivasankar.nbl (not verified)
Re: How to Declare a Function in PeopleCode

please give the suitable answer

csnrkrishna's picture
User offline. Last seen 6 years 7 weeks ago. Offline
Joined: 10/29/2010
Posts: 7
Re: How to Declare a Function in PeopleCode

Function name [(paramlist)] [Returns data_type]
[statements]
End-function

Where paramlist is:

&param1 [As data_type] [, &param2 [As data_type]]...

Ex:
function calc_something(&parm1 as number, &parm2 as number) returns number

Declare Function function_name PeopleCode record_name.field_name event_type

Guest's picture
Guest (not verified)
how to call a function in peoplecode

i want the syntax to call a function ,
i.e record.field.value = some_function().
so i want that with in that bracket wat we should write???

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

First Declare the function where you want to call the function.
then direct call the function. And in the bracket we send the value which is required to manipulate the function as parameter.

For Example:

Function for incrementing field's integer value:

CREATING function in field formula :-

Function Y(&s_num As integer) Returns integer

&s_num = &s_num + 1;

Return &s_num;

End-Function;

DECLARING it on field change event:-

Declare Function y PeopleCode RECORD_NAME.FIELD_NAME FieldFormula;

Calling it on same event fieldchange event :

WinMessage(y(5),0);

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

Thanx sir, after your reply I have solved my problem.
thanx again sir for your help.

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

Thanks a lot. This is very helpful for me.

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

Thanxs sr your answer help me lots....

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

is this possible to define the function in any type of record peoplecode?

Guest's picture
Guest
Re: How to Declare a Function in PeopleCode

is this possible to define the function in any type of record peoplecode?