Arrays in Fast Formula
Arrays in Fast Formula
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.
10 Feb 2020 in the same order. Since the index type of this DBI
th
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.
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(
PER_HIST_ASG_EFFECTIVE_START_DATE.LAST(-
PER_HIST_ASG_EFFECTIVE_START_DATE.NEXT(
99)
PER_HIST_ASG_EFFECTIVE_START_DATE.COUNT
CUSTOM_ARRAY_DBI_NAME.DELETE(2)
PER_HIST_ASG_EFFECTIVE_START_DATE.EXISTS
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
********************************************************************************/
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')
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')
EXIT
l_code_index = PER_SENDT_F_V3_SENIORITY_DATE_CODE.NEXT(l_code_index,-
99)
ELIGIBLE = 'Y'
RETURN ELIGIBLE
After successful compilation your fast formula will look like this
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.
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.
Input Values
Variable
Return Values
ShareSend