cancel
Showing results for 
Search instead for 
Did you mean: 
dbronson22
Nintex Newbie

Calculated column formula to calculated value

Jump to solution

I know that calculated columns don't work on Nintex forms. So my question is, how would I get the following calculated column formula converted into a calculated value on a form?

Calculated column formula: 

=TODAY()+(7-WEEKDAY(TODAY(),2))

Labels: (3)
0 Kudos
Reply
10 Replies
MegaJerk
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

This should replicate what you're trying to achieve. 

formatDate(dateAddDays({Common:CurrentDate}, (7-(new Date ().getDay()))), "d")

Breaking it down into parts: 

//{Common:CurrentDate} === 3/7/2018

//new Date ().getDay() === 3 (aka: Wednesday)



formatDate(dateAddDays({Common:CurrentDate}, (7-(new Date ().getDay()))), "d");

// translated...

// formatDate(dateAddDays(3/7/2018 12:00AM, (7 - (3))), "d");

// translated...

// formatDate(dateAddDays(3/7/2018 12:00AM, 4), "d");

// translated...

// formatDate(3/11/2018 12:00AM, "d");

// translated...

// 3/11/2018
‍‍‍‍
Reply
dbronson22
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

For my understanding, what is "new Date" and ".getDay?" Where are these coming from? 

0 Kudos
Reply
MegaJerk
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

That's just basic javascript (JavaScript getDay() Method or Date.prototype.getDay() - JavaScript | MDN). 

Calculated Value control Formulas are just evaluating javascript at the end of the day, so you can use it inside of there with no problems (most of the time). 

0 Kudos
Reply
dbronson22
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

I figured. However, not getting a result when I preview it, hence I asked. This is what I have: 

0 Kudos
Reply
MegaJerk
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

Make sure that the view options in the properties of your calculated control are set to ReCalculate value on View:




Otherwise you won't be able to preview it. 


0 Kudos
Reply
dbronson22
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

Hmmmm. Mine seems to still be blank...

0 Kudos
Reply
MegaJerk
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

Please copy and paste the code in my first reply into your formula field. You have a typo after the getDay where you have left off the invoking parentheses. 

Reply
Highlighted
dbronson22
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

My man! Perfect! Preciate it!!

0 Kudos
Reply
dbronson22
Nintex Newbie

Re: Calculated column formula to calculated value

Jump to solution

nmarples‌ Do you know if there is a way to restrict a datepicker to not allow for future dates. I was trying to come up with an expression within the Date/Time control to do this, but I think its going to have to be done with javascript. 

With that said, I think I'm close. I know I can do the following or something similar: 

$('#datepicker').datepicker({ maxDate: 0 })

which would essentially not allow for any date past 'today.'

I'm having trouble converting this to being used on the form. I think I would need to store it in the javascript variable and reference it, but I'm not sure.

0 Kudos
Reply