SetVariable script not working
Posted on 2011-03-08
I am trying to generate a weekly report which I want to send as an email via the FMserver.
The script as it is now is not setting the field ContractAlertToRenew4 so that the Find can take place and thereby generating the report which will show all employees who's contracts are due to expire within "X" Number of days.
ContractAlertToRenew4:"Contract Due to Expire in" "4"" Days".This alert will show for any contracts which are nearing expiry within a range of 0 to 10 days.
I need the result :"Contract Due to Expire in" "4"" Days" (or "5" or"9" etc) to be set in the ContractAlertTo Renew4 Field or is there another way.
Show All Records
Enter Find Mode [ ]
Set Variable [ $ContractDueToExpire; Value: Let (
DaysLeft = S_ PERMANENTS PLUS CONTRACTS::Days Left before contract Expires;
DayP = If ( DaysLeft = 0 or DaysLeft > 1 ; " Days" ; " Day" )
Case (IsEmpty ( S_ PERMANENTS PLUS CONTRACTS::Contract Start Date )or IsEmpty (S_ PERMANENTS PLUS CONTRACTS::
Contract end Date )
(DaysLeft < 10) and (DaysLeft >1) ; "Contract Due to Expire in " & DaysLeft & DayP
Set Field By Name [ S_ PERMANENTS PLUS CONTRACTS::Contract Alert to renew 4; GetField($ContractDueToExpire) ]
Perform Find [ ]