Here’s an interesting one I came across in the forums the other day:
i have contact form and PURCHASE DATE Field as (Date) Type. where the user selecting a date in DD/MM/YYYY format ..
now as soon as i fill out this contact form and then if il go to view this particular entry , i want to see the Label there showing the
CUSTOMER SINCE : (here i want to show the number or Days (i.e. 256days , 1year and 3Days) ) or something
i want to show this Result as per the PURCHASE DATE selection, if as an admin i update this PURCHASE DATE
then automatically it will affect to CUSTOMER SINCE result as well ..
but u know i dont have any idea .. how to do this ..
can any sugar master help me how to do this .. pls help me ..
This is something rather trivial to do with Sugar Logic. Just add a new custom field to hold the calculated value, and then add this as the calculated field formula for the field:
What this does is use the daysUntil() function call, which will return the number of days between now and a date in the future. Being a date in the past, it returns a negative number, so using the special properties of multiplying by a -1, we can change the number into a positive one which we can return to the form.