I am trying to generate a discount rate based on the date that an item is submitted. So if it’s submitted before June 1 of Current year then it should be 50, if it’s submitted between June 1 and June 30 then it’s 25, and after June 30 it’s 0.
I had the function working with the {{now}} variable, but when I replace it with the variable for the submission date it didn’t work.
Function with Now Variable:
{{if(now < parseDate(formatDate(now; "YYYY") + "-06-01"; "YYYY-MM-DD"); 50; if(now <= parseDate(formatDate(now; "YYYY") + "-06-30"; "YYYY-MM-DD"); 25; 0))}}
Function:
{{if(8.DateSubmission < parseDate(formatDate(8.DateSubmission; "YYYY") + "-06-01"; "YYYY-MM-DD"); 50; if(8.DateSubmission <= parseDate(formatDate(8.DateSubmission; "YYYY") + "-06-30"; "YYYY-MM-DD"); 25; 0))}}
Sample Data
[
{
"IDSubmission": "CwseMkNCtbvs",
"NameCompany": "cre8ion Group",
"NameFirst": "Corey",
"NameLast": "Test Automation",
"Email": "Corey@cre8iongroup.com",
"PhoneNumber": "(989) 430-1981",
"EmailBilling": "cre8iongroup@gmail.com",
"Session01Type": "Workshop",
"Session01Name": "",
"Session01Location": "",
"Session01Date": "",
"Session01Package01": "($1075) - Platinum Package: Projector & screen, four (4) handheld/lavalier microphone, small sound system, and computer audio hookup.",
"Session01Package02": "",
"Session01Package03": "",
"Session01ALACarte": "Two-Way Zoom ($1650)\n75'' TV Screen with stand ($2000)\nPost-it Flip Chart ($200)\nLaptop ($425)",
"Session01Notes": "I would really like to have a cookie today",
"Session02": "Yes",
"Session02Type": "Information Session",
"Session02Name": "",
"Session02Location": "",
"Session02Date": "",
"Session02Package01": "",
"Session02Package02": "($375) - Premium Package: 75\" TV with screen, two (2) handheld/lavalier microphone, sound system with mixer, and computer audio hookup.",
"Session02Package03": "",
"Session02ALACarte": "Two-Way Zoom ($1650)\n75'' TV Screen with stand ($2000)\nPost-it Flip Chart ($200)\nLaptop ($425)",
"Session02Notes": "No Notes",
"Session03": "Yes",
"Session03Type": "Corporate Reception",
"Session03Name": "",
"Session03Location": "",
"Session03Date": "",
"Session03Package01": "",
"Session03Package02": "",
"Session03Package03": "($6450) Platinum Package: Sound system with mixer, 75\" TV with stand, four (4) handheld/lavalier microphone, 16 RGB Uplights - Static Colors, and computer audio hookup.",
"Session03ALACarte": "Two-Way Zoom ($1650)\n75'' TV Screen with stand ($2000)\nPost-it Flip Chart ($200)\nLaptop ($425)",
"Session03Notes": "No Notes",
"Edit Link": "Edit Submission",
"DateSubmission": "2024-05-07T12:14:31.000Z",
"__IMTINDEX__": 1,
"__IMTLENGTH__": 1
}
]