Adding days onto a date field based on a picklist.
Hi All,
my apologise for the huge amounts of questions ive been asking of late.
I was wondering if someone could point me in the right direction to the following.
Basically on our Form , We have a picklist ( Data column Name: programme, and is located on a "parent" form) a Date field (Data column name: date_of_signup ) and a Planned end date (data column name: traineepot_c_progaim_a28).
When a item is selected from the Picklist we want to add X amount of days on top of the Start Date , to show in the Planned End date.
Hope the above makes sense,
An example of this would be ;
Pick list : Level 5 ( Selected )
Start Date : 01/01/2015
Planned End Date : 01/01/2016 (+12 months )
Pick List : Level 3
Start Date : 01/01/2015
Planned End Date: 01/7/2015 (+6 months)
-
Official comment
Hey Karl, please have a look at the package attached to the bottom of this article and let me know what you think. It uses page level JavaScript and I modified the pick list a bit from my previous comment.
https://iformbuilder.zendesk.com/hc/en-us/articles/201697670
Hope it helps!Comment actions -
Hi Karl, have a look at this article below and see if it helps.
https://iformbuilder.zendesk.com/hc/en-us/articles/201697670-How-do-I-dynamically-set-a-date-
-
Thanks again for the response tony,
That is kind of what im looking for, is there anyway to implement the amount of days that are added , if the pick list was to change,
The reason for this is because we have 6 items in this picklist,
4 of them are the start date + 54 weeks, 2 of them are the Start date + 60 weeks.How do i get the picklist item into that calculation?
IE if i select level 3 on the pick list it adds 54 weeks on to the start date, but if that is changed to level 4 it adds 60 weeks onto the start date.Sorry tony, javascript unfortunately is not one of my strong points.
i do really appreciate your help. -
Hey Karl, one thing you could do is leverage the key_value of the items in the list to help influence the start time. What I mean is that if you have 6 options, they would look something like this.
Label => Key Value
Option1 => option1_54
Option2 => option2_54
Option3 => option3_54
Option4 => option4_54
Option5 => option5_60
Option6 => option6_60This along with ZCDisplayKey function would let you dynamically add the number of start days to the function (please see below). You would need to parse out only the part you care about which comes after the underscore.
https://iformbuilder.zendesk.com/hc/en-us/articles/201698690?
Hope that helps!
Please sign in to leave a comment.
Comments
7 comments