Counting Number of Entries in Element Entry Input Value Validation Fast Formula
Counting Number of Entries in Element Entry Input Value Validation Fast Formula
Pmishra-Oracle Posts: 71 Green Ribbon
Aug 23, 2016 8:06AM edited Oct 11, 2019 10:40AM 13 comments Answered
Hi Folks,
I have a requirement in ICP where we have to restrict the number of entries to 10, whenever
employee/manager is making any new ICP entry.
So need a validation to not allow ICP entry 11th time in given absence period.
Thanks,
Tagged:
Absences, Time & Labor
FlagOff Topic3Like
Answers
Rohit Phulsunge Posts: 328 Bronze Badge
Sep 12, 2016 3:51AM edited Sep 12, 2016 3:51AM
Hi,
Regards,
Rohit
FlagOff TopicLike
Pmishra-Oracle Posts: 71 Green Ribbon
Sep 19, 2016 7:01AM edited Sep 19, 2016 7:01AM
Yes.
FlagOff TopicLike
AshishHCM Posts: 5,929 Bronze Crown
Sep 19, 2016 7:51AM edited Sep 19, 2016 7:51AM
Check this link, this shows how to count for no of entries ( in context with Absence Management
though)... for ICP too something similar would be there ( check for correct DBIs)
Kind Regards
Ashish
FlagOff TopicLike
Pmishra-Oracle Posts: 71 Green Ribbon
Sep 19, 2016 7:57AM edited Sep 19, 2016 7:57AM
Thanks Ashish.
We will surely check this and get back in case it works for us.
FlagOff TopicLike
Rohit Phulsunge Posts: 328 Bronze Badge
Sep 19, 2016 10:19AM edited Sep 19, 2016 10:19AM
Hi Ashish,
I have referred to that thread and don't get it why are we doing it
Regards,
Rohit
FlagOff TopicLike
Pmishra-Oracle Posts: 71 Green Ribbon
Sep 22, 2016 11:54AM edited Sep 22, 2016 11:54AM
@AshishHCM
This sample is for Absence entry validation formula while we are looking for counting element
entries in Input validation formula.
FlagOff TopicLike
AshishHCM Posts: 5,929 Bronze Crown
Sep 22, 2016 1:41PM edited Sep 22, 2016 1:41PM
Hi Rohit,
"'i' in index and 'j' is the variable, since all we want to do is validate that an employee should not
take more than 5 days per incident, just make the following update to the formula text and attach it
to the absence type"
Basically this is to ensure that a specific leave type can not be applied more than 5 days within a 7
day period.
Kind Regards
Ashish
FlagOff Topic1Like
AshishHCM Posts: 5,929 Bronze Crown
Sep 22, 2016 1:42PM edited Sep 22, 2016 1:42PM
Something on the similar lines should work.
Loop through the element entry array and check number of counts
Kind Regards
Ashish
FlagOff TopicLike
User_70BDI Posts: 2 Blue Ribbon
Sep 30, 2016 9:16AM edited Sep 30, 2016 9:16AM
Hi,
We had the same requirement to limit the ICP request considering the element entry count.You can
use the DBI's starting with ELEMENT_ENTRY_RGE% to loop through the element entries
created.
These DBI's are not available in FF of type "Element Input Validation". So I have created a FF of
type "Compensation Default And Override" to get the element entry count
Regards,
Shalini.N
FlagOff TopicLike
Vinod Gowda Posts: 1,582 Bronze Trophy
Sep 30, 2016 11:10AM edited Sep 30, 2016 11:10AM
Hi Shalini,
It would be of great help if u can share those fast formulas here.
Thanks,
Vinod
FlagOff TopicLike
User_70BDI Posts: 2 Blue Ribbon
Nov 7, 2016 8:51AM edited Nov 7, 2016 8:51AM
Hi Vinod,
Please find the codes below:
FORMULA_STATUS = 'S'
l_count = 0
l_default_value = 0
CHANGE_CONTEXTS(END_DATE = l_end_date,START_DATE = l_start_date)
(
I=1
WHILE ELEMENT_ENTRY_RGE_ASSIGNMENT_ID.EXISTS(I) LOOP
(
IF PER_ASG_PAYROLL_INFO_PAYROLL_ASSIGNMENT_ID =
ELEMENT_ENTRY_RGE_ASSIGNMENT_ID[I] AND
ELEMENT_ENTRY_RGE_BASE_ELEMENT_NAME[I] = 'Staff Car Lease 1' AND
ELEMENT_ENTRY_RGE_BASE_VALUE_NAME[I] = 'Lease End Date' THEN
(
l_lease_end_date = ELEMENT_ENTRY_RGE_VALUE[I]
L_LOG_DATA = ESS_LOG_WRITE('Lease End Date:'||ELEMENT_ENTRY_RGE_VALUE[I])
IF l_lease_end_date = 'NA' THEN
(
l_ee_id = ENTRY_ELEMENT_RGE_ENTRY_ID[I]
L_LOG_DATA = ESS_LOG_WRITE('l_ee_id'||TO_CHAR(l_ee_id))
J = 1
WHILE ELEMENT_ENTRY_RGE_ASSIGNMENT_ID.EXISTS(J) LOOP
(
IF PER_ASG_PAYROLL_INFO_PAYROLL_ASSIGNMENT_ID =
ELEMENT_ENTRY_RGE_ASSIGNMENT_ID[J] AND
ELEMENT_ENTRY_RGE_BASE_ELEMENT_NAME[J] = 'Staff Car Lease 1'
AND ELEMENT_ENTRY_RGE_BASE_VALUE_NAME[J] = 'Vehicle Identification
Number' AND l_ee_id = ENTRY_ELEMENT_RGE_ENTRY_ID[J] THEN
(
L_LOG_DATA = ESS_LOG_WRITE('Entered If Of Range:'||'J'||to_char(J)||
ELEMENT_ENTRY_RGE_BASE_VALUE_NAME[J]
||'Start Dt'||TO_CHAR(ELEMENT_ENTRY_RGE_EFFECTIVE_START_DATE[J],'DD-
MON-YYY')||'End Dt'||
TO_CHAR(ELEMENT_ENTRY_RGE_EFFECTIVE_END_DATE[J],'DD-MON-YYY'))
L_LOG_DATA = ESS_LOG_WRITE('EE ID:'||
TO_CHAR(ENTRY_ELEMENT_RGE_ENTRY_ID[J]))
L_LOG_DATA = ESS_LOG_WRITE('Element Entry Value:'||
ELEMENT_ENTRY_RGE_VALUE[J])
l_veh_no = ELEMENT_ENTRY_RGE_VALUE[1]
IF l_veh_no != ELEMENT_ENTRY_RGE_VALUE[J] THEN
(
l_count = l_count + 1
)
)
J = J + 1
)
)
)
I=I+1
)
)
l_log_data = ess_log_write('l_count:'||to_char(l_count))
l_default_value = l_count
RETURN l_default_value
l_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,-1)
l_pay_rel_id = GET_CONTEXT(PAYROLL_RELATIONSHIP_ID,-1)
l_date_earned = get_context (DATE_EARNED, '1951/01/01 00:00:00' (date))
FORMULA_STATUS = 'S'
CALL_FORMULA('ATG_ICP_STAFF_CAR_LEASE_EE_COUNT',
l_entry_count < 'L_DEFAULT_VALUE' DEFAULT 0
)
IF l_entry_count >= 2 THEN
(
FORMULA_MESSAGE = 'Employee is eligible only for 2 car'
FORMULA_STATUS = 'E'
)
IF LEASE_END_DATE < LEASE_START_DATE THEN
(
FORMULA_MESSAGE = 'Lease End Date cannot be less than lease start date'
FORMULA_STATUS = 'E'
)
RETURN formula_Message,formula_status
Regards,
Shalini.N
FlagOff TopicLike
Vinod Gowda Posts: 1,582 Bronze Trophy
Nov 13, 2016 1:39AM edited Nov 13, 2016 1:39AM
THanks Shalini
FlagOff TopicLike
User_CNNBE Posts: 4 Red Ribbon
Oct 11, 2019 10:40AM edited Oct 11, 2019 10:40AM
Hi Shalini,
I'm working on similar issue,s but unable to get the count from the attached fast formula, is there
any change in your formula at a later stage.
We are saving employee contact dependent id in element input value, we are trying to get the
count of UNIQUE of contact person id in element input it is giving wrong value.
Regards
Murali Arisetty