0% found this document useful (0 votes)
16 views

Arrays in Fast Formula

This document provides an overview of using arrays in Oracle Fusion Fast Formulas, emphasizing the importance of understanding array types of database items (DBIs) and their functionalities. It explains how to declare, default, and utilize array type DBIs, including various functions available for manipulating arrays. Additionally, it discusses the application of arrays as input values, return values, and local variables within fast formulas.

Uploaded by

mail.byadav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Arrays in Fast Formula

This document provides an overview of using arrays in Oracle Fusion Fast Formulas, emphasizing the importance of understanding array types of database items (DBIs) and their functionalities. It explains how to declare, default, and utilize array type DBIs, including various functions available for manipulating arrays. Additionally, it discusses the application of arrays as input values, return values, and local variables within fast formulas.

Uploaded by

mail.byadav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

1.

Arrays in Oracle Fusion


Fast Formulas
In this article we will learn how to use and handle arrays in oracle
fusion fast formulas. In oracle fusion fast formulas array are used
extensively thus it has become necessity of the time to be familiar
with the concept. We assume that you have some basic knowledge
about fast formulas. To make this article short, sweet and to the
point we will only talk about concepts of array in fast formula. So
let’s begin.

2. Array Type Data Base Items


(DBI)
Yes you got it right there are array types of database items (DBI)
also, by look they are very much similar to the normal data base
items. To understand it better let’s open an empty fast formula and
search for data base item
“PER_HIST_ASG_EFFECTIVE_START_DATE”

Did you notice the data type of this DBI that reads “Date value
and number index array”. For normal DBIs you generally see data
type value as Number, Text or Date. I am sure you have got it by
now that this is an array type database item.

Learn to Configure Oracle Compensatory Absence Plan Step by Step


Normal DBI holds single value at a time but array type DBI holds
multiple values. By the data type description of this DBI you can get
that it holds date type values, where index is of type number.
PER_HIST_ASG_EFFECTIVE_START_DATE DBI is capable of
storing all effective start date changes happening on an assignment
record. For example let’s assume for an assignment there are five
changes and the effective start dates for those changes are 1 Janst

2010, 30 May 2017, 10 March 2019, 31 December 2019 and


th th st

10 Feb 2020 in the same order. Since the index type of this DBI
th

is number, oracle will store information similar to what is depicted


below.

2.1. How to declare and default array type


DBI
To know more about usages of the array type DBI, let’s create a
simple fast formula with name “Test” and formula
type Participation and Rate Eligibility. Just add below three lines
in fast formula and compile it. If you need to debug your fast
formula, you can read this article » How to Debug Fast Formulas

DEFAULT FOR PER_HIST_ASG_EFFECTIVE_START_DATE IS '1951/12/31 00:00:00'


(date)

ELIGIBLE = 'Y'

RETURN ELIGIBLE

What happened, it didn’t work right!! You must have got below
error. “conflicting type usage”
But why is it so? This is how you declare and default any DBI right?
Actually array type DBI items do not follow conventional default
syntax. They need to be declared and defaulted as follows

DEFAULT_DATA_VALUE FOR
PER_HIST_ASG_EFFECTIVE_START_DATE IS ‘1951/12/31 00:00:00’
(date)
Edit your fast formula and compile again. This time you will not see
the error, as shown in the image below.

2.2. How to use array type DBI


We have so far seen what array type DBIs are and how to declare
and default them. Now let’s understand how to use (or read their
values) inside fast formula. Generally when we want to get value of
a DBI, we directly use them as follows (here PER_ASG_FTE is a DBI
item)

worker_fte = PER_ASG_FTE
However, this will not work in array type DBI, which is obvious
because array is not a single value. When we want to retrieve value
we also need to tell the index position. So if we want to know when
the first assignment change happened for a worker, we will use
syntax like this

first_change = PER_HIST_ASG_EFFECTIVE_START_DATE[1]
Make a note of the index position we are passing using brackets [].
But this is not the recommended way to get first index position.
There could be scenarios where first position is starting from index 5
or something else. So to get the first position we use syntax
like FIRST, as described below.
first_position =
PER_HIST_ASG_EFFECTIVE_START_DATE.FIRST(-1)
2.3. Different Functions Available With
Respect to Array
Function Syntax Example

PER_HIST_ASG_EFFECTIVE_START_DATE.FIRST(

This will retrieve the first position index


if there are no values it will return defau

<Array>.FIRST( <default value that is -1


FIRST value> )

PER_HIST_ASG_EFFECTIVE_START_DATE.LAST(-

This will retrieve the last position index


if there are no values it will return defau

<Array>.LAST( <default value that is -1


LAST value> )

NEXT < Array>.NEXT PER_HIST_ASG_EFFECTIVE_START_DATE.NEXT(


(<index>, <default 99)
value>)
This will retrieve value in index position
if value doesn’t exist there, will return
default value that is -99

PER_HIST_ASG_EFFECTIVE_START_DATE.NEXT(
99)

This will retrieve value prior to index


position 5, if value doesn’t exist there, w

< Array>.PRIOR (<index>, return default value that is -99


PRIOR <default value>)

PER_HIST_ASG_EFFECTIVE_START_DATE.COUNT

This will give the total count of an array.


COUNT <Array> .COUNT

CUSTOM_ARRAY_DBI_NAME.DELETE(2)

This will delete value in index position 2


index position is not passed, it will delet
all values from array.

<Array>. DELETE( <index


DELETE value> )

PER_HIST_ASG_EFFECTIVE_START_DATE.EXISTS

If value exists in index position 1, it will

<Array>. EXISTS ( <index return true otherwise false.


EXISTS value> )

3. Let’s try to understand Arrays


with a real life scenario
To cement the concept we have learnt so far, let’s assume we have
a requirement to check eligibility of an employee for a performance
document based on employees adjusted service date. Adjusted
service date code that we need to consider is
“’ADJ_SERVICE_DATE’”. If employees adjusted service date
anniversary is falling in the current month, he should be eligible
provided his assignment status is in active status.
To get this create a Participation and Rate Eligibility fast
formula using following code
3.2. Fast formula based on the adjusted
service date
/*****************************************************************

FORMULA NAME: AVINASH_PERFORMANCE_DOC_ELIGIBILITY_FF

FORMULA TYPE: Participation and Rate Eligibility

DESCRIPTION : Fast Formula to check the eligibility

Name Date Comments

--------------------------------------------------------------------------------------------

iavinash.com 29-02-2020 Initial Version

--------------------------------------------------------------------------------------------

********************************************************************************/

DEFAULT_DATA_VALUE FOR PER_SENDT_F_V3_SENIORITY_DATE IS '1951/01/01'


(date)

DEFAULT_DATA_VALUE FOR PER_SENDT_F_V3_SENIORITY_DATE_CODE IS 'XX'

DEFAULT FOR PER_ASG_STATUS_CODE IS 'X'


ELIGIBLE = 'N'

l_eff = GET_CONTEXT(EFFECTIVE_DATE, '1951/01/01' (date))

l_code_index = PER_SENDT_F_V3_SENIORITY_DATE_CODE.FIRST(-1)

l_srvc_dt_crr_mn = 'xx'

l_status = PER_ASG_STATUS_CODE

l_crr_mn = to_char(l_eff,'MM')

l_log = ESS_LOG_WRITE('Effective date is :'|| to_char(l_eff, 'DD-MON-YYYY') )

l_log = ESS_LOG_WRITE('Assignment status is : '|| l_status )

WHILE (PER_SENDT_F_V3_SENIORITY_DATE_CODE.EXISTS(l_code_index))

LOOP

IF ( PER_SENDT_F_V3_SENIORITY_DATE_CODE[l_code_index] =
'ADJ_SERVICE_DATE' ) THEN

l_ads_sdt = PER_SENDT_F_V3_SENIORITY_DATE[l_code_index]
l_srvc_dt_crr_mn = to_char(l_ads_sdt, 'MM')

l_log = ESS_LOG_WRITE('Adjusted service date exists for


employee')

l_log = ESS_LOG_WRITE('Adjusted service date is : '||


to_char(l_ads_sdt, 'DD-MON-YYYY') )

EXIT

l_code_index = PER_SENDT_F_V3_SENIORITY_DATE_CODE.NEXT(l_code_index,-
99)

IF ( l_srvc_dt_crr_mn = l_crr_mn AND l_status like 'ACTIVE_%' ) THEN

ELIGIBLE = 'Y'

l_log = ESS_LOG_WRITE('Person is eligible')

RETURN ELIGIBLE
After successful compilation your fast formula will look like this

3.3. Let’s understand the formula and


array concepts more
If you give a close look to this fast formula you will find that

 At line number 11 and 12 we are using two array type data base
items (PER_SENDT_F_V3_SENIORITY_DATE and
PER_SENDT_F_V3_SENIORITY_DATE_CODE) check how are they
declared.

 At line number 17 we are getting the first index position of DBI


PER_SENDT_F_V3_SENIORITY_DATE_CODE

 At line number 25 before going inside WHILE loop we are checking if


that index position exists or not, if it doesn’t, we won’t enter loop.

 At line number 28 we are getting value from DBI


PER_SENDT_F_V3_SENIORITY_DATE_CODE to check if it matches to
adjusted service date “ADJ_SERVICE_DATE”. If it does we need to
read the adjusted service date or move on.

 At line number 30 we are reading the value from DBI


PER_SENDT_F_V3_SENIORITY_DATE for further calculation.
 At line number 38 we are incrementing the index position by using
function NEXT.

3.4. More About Array Indexes


Hope things are getting better….. Please also understand that index
type of an array is not always number, text could also be index of an
array. Please also note some other points related to array index.

 The index types are either text or number.

 Text indexes are upper case unique.

 Gaps in index value sequences are permitted.

 Number indexes are truncated to remove any fractional part.

 You may iterate an array in an index either forwards or backward.


3.4.1. Array Data Types
In the example above we have seen DBI of data type DATE with
index NUMBER. Likewise we have few other data types for array as
mentioned below.

Array Type What does it mean

NUMBER_NUMBER Number value with number index

NUMBER_TEXT Number value with text index

DATE_NUMBER Date value with number index

DATE_TEXT Date value with text index

TEXT_NUMBER Text value with number index

TEXT_TEXT Text value with text index

Since we have got the concept of Array type DBI, let’s also
understand where else we can use arrays in oracle fusion fast
formulas. If you need to know contexts supported by any fast
formula you can run the query available in this article » Oracle Cloud
Reusable Queries.
4. Different Types of Arrays in
Oracle Fusion Fast Formulas
Since we have got the concept of Array type DBI, let’s also
understand where else we can use arrays in oracle fusion fast
formulas.

Arrays can also be used as

 Data Base Item (DBI) – have already explained above

 Input Values

 Variable

 Return Values

4.1. Use of Arrays in Input Values


Like database items arrays can be used as input vales also but input
values supported by any fast formulas purely depends on the type of
fast formula you are working on. Global Absence Accrual Matrix
Formula is one example where array is used as input value. Below
are the two array type input values used by Global Absence Accrual
Matrix Formula.

Variable Name Data Type Description

Array of dates returned by the Accrual Event


IV_EVENT_DATES Date_Number formula.

Array of accrual values fetched from the accrual


matrix as of the dates contained in the accrual
IV_ACCRUAL_VALUES Number_Number event dates array.

4.1.1 Method to declare array type input


values
Like we have the different syntax for declaring data base item we
also have different syntax for input value as arrays. Below is the
example to declare input value IV_EVENT_DATES inside Global
Absence Accrual Matrix Formula.
DEFAULT FOR IV_EVENT_DATES IS EMPTY_DATE_NUMBER
4.2. Use of Arrays in Return
Values
Similar to input values some fast formulas support array type return
values. Global Absence Accrual Event fast formula is one
example, which return array type return values.

Variable Name Data Type Description

Array of dates that feeds into the accrual matrix whic


can be used for band change pro-ration. Correspondin
accrual values derived from the matrix also feeds into
IV_EVENT_DATES Date_Number matrix formula

4.3. Use of Arrays as variables


You can also have array as your local variable, it is just that you
need to mentioned the index when you want to capture the record.
For example you can syntax like below to store

L_LOCAL_ARRAY[1] = ‘Hello World’

5. Arrays in Oracle Fusion fast


Formulas
Hope you enjoyed reading this article and was able to gain some
knowledge about arrays in oracle fusion fast formula. Please give me
your feedback and always post your followup question here » oracle
fusion forum.
Tags: Arrays in Fast Formula Learn Oracle Fast Formula

ShareSend

You might also like