• Status: Solved
• Priority: Medium
• Security: Public
• Views: 422

# Insert a calculated Field between " "

Hi
I need have a calculated field inserted to form part of the result of the text .
IE.I need to have the result read..."Contract Due to expire in 4 (Days left before Contract Expires)Days"
The example below not giving me this .The Function works without the GeatasText(Days..etc
Case (IsEmpty ( Contract Start  Date )or IsEmpty ( Contract end Date );"";
Days Left before contract Expires<10;"Contract Due to Expire in;(GetasText(Days Left before contract Expires))";
)
Thanks
0
Krisraychris
• 3
• 3
1 Solution

Commented:
Try this:
Let (
[
~NumDays = Get ( CurrentDate ) - ( Get ( CurrentDate ) - 4 ) ;   // Replace with Contract end Date
~Unit = If ( ~NumDays = 0 or ~NumDays > 1 ; " Days" ; " Day" )
];
Case (
// IsEmpty ( Contract end Date ) ; ""
~NumDays < 10 ; "Contract Due to Expire in " & ~NumDays & ~Unit ;
""
)
)

It will produce:  Contract Due to Expire in 4 Days
0

Commented:
I forgot to mention to change ( Get ( CurrentDate ) - 4 ) to Contract end Date and to remove the // in the case statement.
0

Author Commented:
I have made some changes to your idea and it looks ok for now.I woudl be pleased to know if you think this is ok.

Case(  Contract end Date-Get(CurrentDate)>=0;Contract end Date-Get(CurrentDate);Contract end Date-Get(CurrentDate)<0;"")

Let (
[
~NumDays =    Days Left before contract Expires;
~Unit = If ( ~NumDays = 0 or ~NumDays > 1 ; " Days" ; " Day" )
];
Case (IsEmpty ( Contract Start  Date )or IsEmpty ( Contract end Date )
; "";
(~NumDays < 10)  and (~NumDays >1) ; "Contract Due to Expire in " & ~NumDays & ~Unit ;

~NumDays >=10 ; "Contract Active" ;~NumDays =0 ; "Contract Expired " ;""))
0

Author Commented:
DaysLeftBeforeContractExpires :
Case(  Contract end Date-Get(CurrentDate)>=0;Contract end Date-Get(CurrentDate);Contract end Date-Get(CurrentDate)<0;"")

[
~NumDays =    Days Left before contract Expires;
~Unit = If ( ~NumDays = 0 or ~NumDays > 1 ; " Days" ; " Day" )
];
Case (IsEmpty ( Contract Start  Date )or IsEmpty ( Contract end Date )
; "";
(~NumDays < 10)  and (~NumDays >1) ; "Contract Due to Expire in " & ~NumDays & ~Unit ;

~NumDays >=10 ; "Contract Active" ;~NumDays =0 ; "Contract Expired " ;""))
0

Commented:
Looks good.  The only thing you might consider is the condition for "Contract Expired".  You may want to change "~NumDays =0" to "~NumDays <= 0".  The thinking is once the  number of days until the contract expires goes to zero or negative it should always read "Contract Expired "
0

Author Commented:
Perfect...Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.