Highlighted

Autopopulate a date

Avatar

28-05-2008

At the top of my form, I have a user defined field for the last date in a given week (Saturday)in the format MM/DD/YYYY. Below that there I have the days of the week (Sunday through Saturday). In this table each day should correspond with it's numerical counterpart.



For example, Saturday would be the user defined date, Friday would be the user defined date - 1, Thursday would be the user defined date - 2, etc.



So far I have a calculation in the "populated" area as FormCalc (where 'week' is the user defined date):



if(HasValue(week) then

$.rawValue = Num2Date( Date2Num(week) - 1) )

else $.rawValue = ""

endif



With the current formula, I get nothing, no errors or calculations.



Additionally I'd like the autopopulated date to be in the format of MM/DD rather than MM/DD/YYYY.



Any Suggestions?

Replies

Highlighted

Avatar

Avatar

gkaiseril

Avatar

gkaiseril

gkaiseril

28-05-2008

You may have to provide the format of the string being converted to a number. You can also format the result of the 'Num2Date()' function.
Highlighted

Avatar

28-05-2008

all of the fields are text input boxes with FormCalc and *calculate formulas...however given the formula above, i don't get anything, so should i change the formula all together or is there a better way to get these results? i'm new to the form building and XML stuff, so thank you for your patience
Highlighted

Avatar

Avatar

gkaiseril

Avatar

gkaiseril

gkaiseril

28-05-2008

I have found that using the formatted value are more reliable for the date and time functions.



And if you try different strings within the "Num2Date" funtion you can get different parts of the date from numbers for everything to long words for the month and day of the week.
Highlighted

Avatar

29-05-2008

ok, well the big problem is getting the general formula to work...i can't get it to autopopulate off of the user inputed date.



user inputs 03/31/08 the seven autopopulated fields would be 3/31/08, 3/30/08, 3/29/08, 3/28/08, 3/27/08, 3/26/08, 3/25/08



so i just need to figure out the formula that will do that for me