RULE Problem

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

RULE Problem

Post by customaware »

I have the following Rule on a BO....

Code: Select all

IF
/* Usual Non Working Day. EDLH Duration = 0. No Event. No Toggle Shift */
 
EmployeeLabourMonth.D18T WAS CHANGED AND 
CHARS_FROM_LEFT(EmployeeLabourMonth.D18T,1)<>'-' AND
EmployeeLabourMonth.ps_EDLH18.Duration=0 AND 
EmployeeLabourMonth.ps_EDLH18.ps_AbsenceApplicationEvent IS UNDEFINED
THEN 

EmployeeLabourMonth.D18WD='Yes'
EmployeeLabourMonth.D18D=AS_NUMBER(EmployeeLabourMonth.D18T)*3600000 
EmployeeLabourMonth.ps_EDLH18.TimeStart=EmployeeLabourMonth.ob_EmployeeSalaryPlanPeriod.ps_EmployeePayrollSettings.DefaultTimeStart
EmployeeLabourMonth.ps_EDLH18.TimeEnd=EmployeeLabourMonth.ps_EDLH18.TimeStart+EmployeeLabourMonth.D18D

ELSE

IF
/* Usual Non Working Day. EDLH Duration = 0. No Event. Toggle Shift */
 
EmployeeLabourMonth.D18T WAS CHANGED AND 
CHARS_FROM_LEFT(EmployeeLabourMonth.D18T,1)='-' AND
EmployeeLabourMonth.ps_EDLH18.Duration=0 AND 
EmployeeLabourMonth.ps_EDLH18.ps_AbsenceApplicationEvent IS UNDEFINED
THEN 

EmployeeLabourMonth.D18WD='Yes' 
EmployeeLabourMonth.D18T=REPLACE_PATTERN (EmployeeLabourMonth.D18T,'-','')
EmployeeLabourMonth.D18D=AS_NUMBER(EmployeeLabourMonth.D18T)*3600000 
EmployeeLabourMonth.ps_EDLH18.TimeStart=EmployeeLabourMonth.ob_EmployeeSalaryPlanPeriod.ps_EmployeePayrollSettings.DefaultTimeStart
EmployeeLabourMonth.ps_EDLH18.TimeEnd=EmployeeLabourMonth.ps_EDLH18.TimeStart+EmployeeLabourMonth.D18D
ToggleDayshiftNightshift USING EmployeeLabourMonth.ps_EDLH18
In the logs I am seeing this error.....
Clearly it is concerning the 2nd line of each IF.
CHARS_FROM_LEFT Error.jpg
CHARS_FROM_LEFT Error.jpg (33.99 KiB) Viewed 4231 times
Wondering if anyone can either spot what is wrong and / or suggest how to fix please?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: RULE Problem

Post by Jaymer »

Maybe just the intricacy of the NOT

1) TRY SUBSTRING
2) try > ‘-‘ instead of <>
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
RLJB
Posts: 914
Joined: Tue Jan 05, 2010 10:16 am
Location: Sydney, Australia

Re: RULE Problem

Post by RLJB »

Mark is

CHARS_FROM_LEFT(EmployeeLabourMonth.D18T,1)='-'

just checking if it is a negative number?

if so, why not use <0

also, we have found issues with the char - there seems to be different types of -
Rod. Aware 8.6 (latest build), Developer Edition, on OS Linux (Ubuntu) using GUI hosted on AWS EC2, MYSQL on AWS RDS
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: RULE Problem

Post by customaware »

Good one Rod.

Never crossed my mind to test a string for less than zero but it works.

Thanx.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Post Reply