Tech Off Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Sort Dates in an XML String field

Back to Forum: Tech Off
  • User profile image
    qwert231

    I have a little app that stores it's dataset data in an XML file. I created the XML schema in VS. I have 2 fields, DateOut and DateIn (For checking out and in items). These fields are String fields. (Because DateIn will be empty until the items are back in.)

    When I apply the datatable w/ those fields to a dataview and sort by them, it goes 1/1/05,10/1/05,11/1/05,12/1/05,2/1/05 and so on since the month is first.

    What's a better way to do this?

  • User profile image
    footballism

    how about defining DateOut and DateIn as date element in the schema file? such as:
    <xsd:element name="DateOut" type="xsd:date"/>

    Sheva

  • User profile image
    qwert231

    If I define it as a Date Field, I cannot have null entries.

  • User profile image
    Rossj

    You're right, no null entries - but you could specify a default using the aptly named default attribute Smiley

  • User profile image
    Sven Groot

    If you want sortable dates, use ISO date format: yyyy-mm-dd.

  • User profile image
    SimonJ

    But can't you mark the DateIn field as optional (minoccurs=0 isn't it)? That way it can be a date or just not present.

    Do shout if I've got the wrong end of the stick.

    SimonJ

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.