Tim Hardin
wading in the water Posts:24
|
02-07-2013 07:34 AM |
|
Hi all, We are using DF to save a date field to a MSSQL Database. However, when we go back to the page, we cannot get it to populate the field. It is saving correctly to the DB. It is the read that is not working. All our other fields are being populated properly. The demo here does not seem to give info on the way the fields are wanting the date formatted: Thanks Tim
What format should the data be coming back in? |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
02-07-2013 01:40 PM |
|
I would recommend using the mm/dd/yyyy format. Perhaps try this: 1.) If your Date Column name is "DateCreated", then use the SQL Below: Select Convert(char(10), DateCreated, 101) As DateCreated In order to Bind/Map the value to a field on your Dynamic Form, be sure that you have a Dynamic FOrm Question with the short field name of "DateCreated". I assume you're using Initial SQL Binding? What field type are you using? Textbox? Date type, Combo Boxes, Textbox with Calendar, etc... Thanks, Ryan
|
|
|
|
|
Mark Merrick
skipping stones Posts:5
|
02-12-2013 07:24 AM |
|
Hi Ryan, Regards. I am working with Tim on this issue. Yes we are using Initial SQL Bind. All the other fields populate except the 4 date fields on our form. For testing on the form I tried using your "Textbox w/Calendar", "Month,Day,Year Textbox", and "Month,Day,Year Combobox". In the database I have the fields saving to a NVARCHAR(10) but also tried DateTime on one field. Using the Convert I can return all those date fields as mm/dd/yyyy. Testing in MSSQL Manager the query runs and the data looks good. But it still won't populate on the form. Snippet from my Query: SELECT Convert(char(10), [DOB], 101) As DOB, Convert(char(10), [VISA_issue_date], 101) As VISA_issue_date, Convert(char(10), [VISA_expiration_date], 101) As VISA_expiration_date, Convert(char(10), [copy_passport], 101) As copy_passport, FROM App_Table1 WHERE UserID = $(UserID) Any ideas?
|
|
|
|
|
Mark Merrick
skipping stones Posts:5
|
02-12-2013 07:31 AM |
|
OK I take part of that back - the DOB field that I have setup as "Month,Day,Year Combobox" is now working. Other date fields that use "Textbox w/Calendar" and "Month,Day,Year Textbox" do not work. I am curious as to why those don't work but maybe we can be happy with the "Month,Day,Year Combobox". |
|
|
|
|
Mark Merrick
skipping stones Posts:5
|
02-12-2013 07:37 AM |
|
Whoops - EDIT - the DOB is actually using "Textbox w/Calendar" so that is the field type that seems to work. |
|
|
|
|
Chad Nash Posts:5260
|
02-13-2013 03:50 PM |
|
Hi Mark - So, when you are using "SQL Bind" or in "Edit" mode, you are saying that the date field type does not bring the data in for combo box date type? I think that this could be related to how we store that data in the database for that field. I think we have it stored as a comma separated value instead of with /. So... Maybe that is the problem and you can bind it such as "12,15,2012". If that is the case you can probably change your query to work properly with how our module populates that field type. Thanks, -Chad
|
|
|
|
|
Mark Merrick
skipping stones Posts:5
|
02-14-2013 07:59 AM |
|
Yes Chad the databind using Convert(char(10), [DOB], 101) As DOB populates only on a date field with the form field type "Textbox with Calendar".
So it sounds like your saying that we need to return the field in the format "12,15,2012" if we want the other form field date types to work. |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
02-20-2013 06:41 AM |
|
Hello Mark, Regarding Chad's comments, if you're saving [DOB] as mm/dd/yyyy in the a custom database table, but are using Initial SQL Bind to pull in the record you're looking for. Then you can use a SQL Replace Statement. Select Replace(DOB, '/', ',') As DateWithCommas from YourTable Then the DOB Column will replace the "/" with ",". As per Chad's recommendation, this will assist you in following his instructions. Please try it out and let us know if it begins working for you. Thanks, Ryan |
|
|
|
|