Listviews - Date format

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Listviews - Date format

Post by Susan Smith »

Can someone help me with displaying a date in a listview? I have a serial number date and I can't figure out how to display it as a date (m/d/cy) in the grid unless I pre-convert it to a regular date first in which case it won't sort correctly in the grid.

I hunted through the wiki and can't anything, though the grid & list page links to release notes of 04/16/06 which say it discusses the "new date format" (it doesn't). I tried to find a date example from our homework in Gabriel's conference classes, to no avail.

I just need to know what the grid spec/form in the HEADER statement should be for the date column if I start with a serial # date.

Thanks

-- Susan
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post by Gabriel »

As I understand it the header column format spec is "DATE(m/d/cy)". This is a numeric field format that displays the given number (days value) as a formatted date.

You must give the date values in a numeric array in order for it to work.

Gabriel
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Post by Susan Smith »

Thank you! That was what I was looking for. Now if only I could center the date in the column. But that's pretty minor. My dates are working now.

Thanks Gabriel.

-- Susan
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Post by GomezL »

I remember something about being able to use DATE(MM/DD/CCYY) as the format and also using a Character Field.

My Character field is formated as MM/DD/CCYY

My goal is to be able to pass Character fields to a Grid, and have the sort as date fields.

Does anyone know the syntax for this? (Also the BR version that implemented it).
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

Use the DATE$ format.

print date$(days(05201983,"m/d/cy"),"month d,cy")

for example. BR, when it works with this stuff needs to have the underlying date in DAYS format. You will need to strio the "/" from the input conversion to days because the "/" will casue a calulation tht you don't want.
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

From 4.1 release notes-

********** A new FIELDS format is supported: **********

row,col,DATE(dd/mm/yy)

- The values are displayed as dates but are stored internally
as day of century.
- The mask may be any valid DATE() mask.

Numeric Column Sorting
2D controls now facilitate numeric column sorting. This works well in
conjunction with the new DATE field format (see release notes 04/06/06)
where the data is stored as day of century, but is displayed as a
formatted date. It also works with all numeric columns.

The 4.1 release notes should also have said:

The user and the program works with the full date format while BR converts it to and from day of century for internal sorting purposes.


----------------------------------------------------
The 4.2 release notes say-

In GRIDs and LISTs only, string arrays may be used to process numeric values. BR automatically performs VAL and STR conversions as needed. If string data is passed to a numeric field type such as N or DATE then it is automatically converted to numeric form for internal processing.
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Post by GomezL »

I figured out my problem.

In the Grid Spec, I need to use DATE(m/d/cyy)
In the Character Field, I need to pass the 'DAYS' or Julian Value.

My string contained a "Formatted Date" "MM/CC/CCYY".

I don't suppose there is a format that will accept a "Formatted Date", but still treat the column as a Date?
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

The user and the program works with the full date format while BR converts it to and from day of century for internal sorting purposes.
Upon further investigation, I have learned that the DATE format only works with internal storage of day of century. So my above quote is incorrect. I should have said:
The program works with day of century, while the user works with the full date format.
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Post by GomezL »

I like the first quote better!

My hope was to change a form statement, and have it work with no additional changes, still the existing functionality of using the Day of century in the string works nicely!
Post Reply