Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Change Date field from a character format to a Date format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change Date field from a character format to a Date format

    Daily I import a customer's csv file which has a date field formatted as a character field. I import this csv file into a flat file which contains all of the fields used in my invoice set. I then append the fields into the different tables in the set.

    No problems there.

    Because of the character formatting in the date field in my invoice header table I am unable to filter on the date field in my reports.

    Is there a function to change the date field from a character format to a date format in Alpha after importing the csv file so that it can be appended into another table which has a date field formatted as a date field?

    Of course after the file is changed and appended by the invoice header table it must be changed back to a character field ready for the next days csv file.

    I hope that this is clear. All help is appreciated.

    Thanks..

    Bill

    #2
    Re: Change Date field from a character format to a Date format

    Hi Bill,

    Have another field for the date but as a Date.

    Create an update operation to convert the csv date to the new date field. Normally the function is ctod(), but that all depends on the format of the character date. If the import is run from a script then this operation could be added to the script.

    Could you show us the exact format of the character date.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: Change Date field from a character format to a Date format

      Keith,

      The character format imported is like the following: 7/14/2010.

      Your update suggestion may work.

      Thanks..

      Bill

      Comment


        #4
        Re: Change Date field from a character format to a Date format

        I have not figured this out at this time. Still looking for help.

        Thanks..

        Bill

        Comment


          #5
          Re: Change Date field from a character format to a Date format

          Hi Bill,

          Please note the format for the function is ctod("07/14/2010").

          Check out the help file to see how you can also use {}.
          Regards
          Keith Hubert
          Alpha Guild Member
          London.
          KHDB Management Systems
          Skype = keith.hubert


          For your day-to-day Needs, you Need an Alpha Database!

          Comment


            #6
            Re: Change Date field from a character format to a Date format

            Keith,

            I changed the character date field to "dateC" and I created another date field formatted as "date". If I can replace the date field(date format) with the "datec" (character format) that would do it.

            Bill

            Comment


              #7
              Re: Change Date field from a character format to a Date format

              Bill,
              If I can replace the date field(date format) with the "datec" (character format) that would do it.
              As I mentioned before you will need to create an Update from Operations.

              This is where you set the new date field with the value of the original character date field using the function in the expression.

              If you have Skype call me.
              Last edited by Keith Hubert; 07-17-2010, 09:46 PM.
              Regards
              Keith Hubert
              Alpha Guild Member
              London.
              KHDB Management Systems
              Skype = keith.hubert


              For your day-to-day Needs, you Need an Alpha Database!

              Comment


                #8
                Re: Change Date field from a character format to a Date format

                Keith,

                I followed your suggestion and came up with the following:

                a_tbl = table.current()
                update.fields = 1
                update.field1 = "DATE"
                update.expr1 = "ctod(datec)"
                a_tbl.update()

                It looks like what I needed.

                Thanks..

                Bill

                Comment


                  #9
                  Re: Change Date field from a character format to a Date format

                  Originally posted by Billn View Post
                  Daily I import a customer's csv file which has a date field formatted as a character field. I import this csv file into a flat file which contains all of the fields used in my invoice set. I then append the fields into the different tables in the set.

                  No problems there.

                  Because of the character formatting in the date field in my invoice header table I am unable to filter on the date field in my reports.

                  Is there a function to change the date field from a character format to a date format in Alpha after importing the csv file so that it can be appended into another table which has a date field formatted as a date field?

                  Of course after the file is changed and appended by the invoice header table it must be changed back to a character field ready for the next days csv file.

                  I hope that this is clear. All help is appreciated.

                  Thanks..

                  Bill
                  Whoa, You appear to be making things unnecessarily difficult.

                  First, if your character date is simply something like "03/09/2010", just change that field in your "flat file" (DBF table) to be a date field and then in your import operation change it to a date import. Alpha will do exactly what you want, no update needed. Also, you could have done this when you first created your "flat file" if you created it via an import operation (just change from character to date for any such fields and then let the import create your table).

                  Second, if you don't want to change your "flat file" structure, when you append to other tables merely use an expression in the append operation to change the character field to a date. Again, no need for an additional field or an update operation. But, I would go with the first option (above).

                  Raymond Lyons

                  Comment


                    #10
                    Re: Change Date field from a character format to a Date format

                    Raymond,

                    I've tried your suggestion before I started this thread. Alpha will not allow me to import a character field into a date field or at least I get an error message that "field types don't match".

                    The above update operation does work for me.

                    Thanks..

                    Bill

                    Comment


                      #11
                      Re: Change Date field from a character format to a Date format

                      Import the field as a character. If as you say, the field is in the 07/14/2010 format all you have to do is change the field type in the table structure from character to date and it will change to the correct date. Even if it was in any format with 2 forward slashes, e.g. 7/1/95 it will properly change to the correct date, i.e. 07/01/1995. If you change it back to character, it will take a different format.

                      Alternatively, you could have a calc field in the table:
                      calc_date=ctod(your_date_field)
                      and use that field in your calculations.

                      Comment


                        #12
                        Re: Change Date field from a character format to a Date format

                        Originally posted by Billn View Post
                        Raymond,

                        I've tried your suggestion before I started this thread. Alpha will not allow me to import a character field into a date field or at least I get an error message that "field types don't match".

                        The above update operation does work for me.

                        Thanks..

                        Bill
                        As G says, it does work just as I described. Don't know what you are doing differently but an update of any kind is totally unnecessary. I have done it as I described for years and my users do it every day. I suspect you are not changing the field type in the import operation either when building it or after it is built by the genie. And of course if your "flat file" field is character you must change that to a date type. But, whatever...

                        Raymond Lyons

                        Comment

                        Working...
                        X