Drop-Down, Calendar issue

Hi team,

I have an issue with drop-down menus/ calendars. If I go back and change the option selected within the drop-down menu, I am keeping the old text as well.

Please see my below example that outlines my problem:

Dropdown Menu: Yes, No

{If: dropdown menu = Yes} Calendar 1:
{if: left(Calendar1, 2)>1} = Apples

{If: dropdown menu = No} Calendar 2:
{if: left(Calendar2, 2)>1} = Bananas

The problem I have, is if someone first selects ‘Yes’ and clicks a date, and then goes back and selects ‘No’ and subsequently selects another date, it is showing text “Apples Bananas” - can you please advise how I can have it automatically remove the "Apples" leaving only "bananas" behind and vice versa if the situation is flipped?

Many thanks,
Jake

Hi Jake,

My understanding is you have something roughly equivalent to this (I'm using menus instead of calendar fields for simplicity):

{formmenu: yes; no; name=selection}

{if: selection}
Calendar 1: {formmenu: Yes; default=No; name=calendar1}
{else}
Calendar 2: {formmenu: Yes; default=No; name=calendar2}
{endif}

{if: calendar1}Apples{endif}
{if: calendar2}Banana{endif}

I think you would like to change it to something like the following. By checking the main menu selection when also displaying the words, you can get what I think you are looking for:

{formmenu: yes; no; name=selection}

{if: selection}
Calendar 1: {formmenu: Yes; default=No; name=calendar1}
{else}
Calendar 2: {formmenu: Yes; default=No; name=calendar2}
{endif}

{if: selection and calendar1}Apples{endif}
{if: (not selection) and calendar2}Banana{endif}

Does that help?

Apologies, I am struggling to get my head around this solution and apply it to my problem. It may be because the example I provided is too simple.

Please see below for what I am using this for:
C11 (is just one of two calendars)

The below snippet is used to work out accrual rates for employees, who's holiday calendar runs from January to December.

Calendar 2 (not included in the example) does the same, but for employees who's holiday runs from August to July.

Please select the employee's leavers date from the calendar:{formdate: DD/MM/YYYY; name=C11; default=2023-01-01}
{if: left(C11, 2)>1 AND left(C11, 2)<31 AND (substring(C11,4,2)=1) } The employee has 0 days accrued (plus any long service days). {endif: trim=right}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=1) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<28 AND (substring(C11,4,2)=2) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=28 AND (substring(C11,4,2)=2) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=3) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=3) } The employee has 6 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=4) } The employee has 6 days accrued (plus any long service days).{endif: trim=yes}

The above example only covers to April, this does continue until December. There is also a 2nd calendar which produces different text for each month. Is what I am asking for possible with the current model?

Your help with this is much appreciated.

Sorry, I'm not sure I understand. You mentioned some text being left behind in your original question but I don't see it in your example.

What steps should I follow to reproduce the state you want to avoid?

My fault - I was struggling to isolate exactly the part of the snippet I needed.

Snippet contents.
Does the employee have a pre-2000 start date?{formmenu: default=-please select-; Yes; No; name=Air1}
{if: Air1 =="Yes"} Please select the employee's leavers date from the calendar:{formdate: DD/MM/YYYY; name=C1; default=2023-01-01}{endif: trim=left}
{if: Air1 =="No"} Please select the employee's leavers date from the calendar:{formdate: DD/MM/YYYY; name=C11; default=2023-01-01}{endif: trim=left}
{if: left(C1, 2)>1 AND left(C1, 2)<31 AND (substring(C1,4,2)=1) } The employee has 10 days accrued. {endif: trim=right}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=1) } The employee has 12 days accrued. {endif: trim=yes}
{if: left(C1, 2)<28 AND (substring(C1,4,2)=2) } The employee has 12 days accrued. {endif: trim=yes}
{if: left(C1, 2)=28 AND (substring(C1,4,2)=2) } The employee has 14 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=3) } The employee has 14 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=3) } The employee has 16 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=4) } The employee has 16 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=4) } The employee has 18 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=5) } The employee has 18 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=5) } The employee has 20 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=6) } The employee has 20 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=6) } The employee has 22 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=7) } The employee has 22 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=7) } The employee has 24 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=8) } The employee has 24 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=8) } The employee has 27 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=9) } The employee has 2 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=9) } The employee has 4 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=10) } The employee has 4 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=10) } The employee has 6 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=11) } The employee has 6 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=11) } The employee has 8 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=12) } The employee has 8 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=12) } The employee has 10 days accrued. {endif: trim=yes}

{if: left(C11, 2)>1 AND left(C11, 2)<31 AND (substring(C11,4,2)=1) } The employee has 0 days accrued (plus any long service days). {endif: trim=right}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=1) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<28 AND (substring(C11,4,2)=2) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=28 AND (substring(C11,4,2)=2) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=3) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=3) } The employee has 6 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=4) } The employee has 6 days accrued (plus any long service days).{endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=4) } The employee has 8 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=5) } The employee has 8 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=5) } The employee has 10 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=6) } The employee has 10 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=6) } The employee has 12 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=7) } The employee has 12 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=7) } The employee has 14 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=8) } The employee has 14 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=8) } The employee has 16 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=9) } The employee has 16 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=9) } The employee has 18 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=10) } The employee has 18 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=10) } The employee has 20 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=11) } The employee has 20 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=11) } The employee has 22 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=12) } The employee has 22 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=12) } The employee has 25 days accrued (plus any long service days). {endif: trim=yes}

Sorry about the wall of text, but I figure at this point it's probably best to show you exactly what I have - issue is still in regard to going back to dropdown menu and having the old text remain.

It sounds like you want something like this:

Snippet contents.
Does the employee have a pre-2000 start date?{formmenu: default=-please select-; Yes; No; name=Air1}
{if: Air1 =="Yes"} Please select the employee's leavers date from the calendar:{formdate: DD/MM/YYYY; name=C1; default=2023-01-01}{endif: trim=left}
{if: Air1 =="No"} Please select the employee's leavers date from the calendar:{formdate: DD/MM/YYYY; name=C11; default=2023-01-01}{endif: trim=left}

{if: Air1 = "Yes"}
{if: left(C1, 2)>1 AND left(C1, 2)<31 AND (substring(C1,4,2)=1) } The employee has 10 days accrued. {endif: trim=right}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=1) } The employee has 12 days accrued. {endif: trim=yes}
{if: left(C1, 2)<28 AND (substring(C1,4,2)=2) } The employee has 12 days accrued. {endif: trim=yes}
{if: left(C1, 2)=28 AND (substring(C1,4,2)=2) } The employee has 14 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=3) } The employee has 14 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=3) } The employee has 16 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=4) } The employee has 16 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=4) } The employee has 18 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=5) } The employee has 18 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=5) } The employee has 20 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=6) } The employee has 20 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=6) } The employee has 22 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=7) } The employee has 22 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=7) } The employee has 24 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=8) } The employee has 24 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=8) } The employee has 27 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=9) } The employee has 2 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=9) } The employee has 4 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=10) } The employee has 4 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=10) } The employee has 6 days accrued. {endif: trim=yes}
{if: left(C1, 2)<30 AND (substring(C1,4,2)=11) } The employee has 6 days accrued. {endif: trim=yes}
{if: left(C1, 2)=30 AND (substring(C1,4,2)=11) } The employee has 8 days accrued. {endif: trim=yes}
{if: left(C1, 2)<31 AND (substring(C1,4,2)=12) } The employee has 8 days accrued. {endif: trim=yes}
{if: left(C1, 2)=31 AND (substring(C1,4,2)=12) } The employee has 10 days accrued. {endif: trim=yes}
{elseif: Air1 = "No"}
{if: left(C11, 2)>1 AND left(C11, 2)<31 AND (substring(C11,4,2)=1) } The employee has 0 days accrued (plus any long service days). {endif: trim=right}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=1) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<28 AND (substring(C11,4,2)=2) } The employee has 2 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=28 AND (substring(C11,4,2)=2) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=3) } The employee has 4 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=3) } The employee has 6 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=4) } The employee has 6 days accrued (plus any long service days).{endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=4) } The employee has 8 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=5) } The employee has 8 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=5) } The employee has 10 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=6) } The employee has 10 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=6) } The employee has 12 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=7) } The employee has 12 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=7) } The employee has 14 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=8) } The employee has 14 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=8) } The employee has 16 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=9) } The employee has 16 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=9) } The employee has 18 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=10) } The employee has 18 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=10) } The employee has 20 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<30 AND (substring(C11,4,2)=11) } The employee has 20 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=30 AND (substring(C11,4,2)=11) } The employee has 22 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)<31 AND (substring(C11,4,2)=12) } The employee has 22 days accrued (plus any long service days). {endif: trim=yes}
{if: left(C11, 2)=31 AND (substring(C11,4,2)=12) } The employee has 25 days accrued (plus any long service days). {endif: trim=yes}
{endif}

Is that what you are looking for?

Wow - all it took was adding an if/ else to resolve. Thanks so much for your help!