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

Newbie - CSV Import challenge

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

    Newbie - CSV Import challenge

    Sorry, I have tried to follow all the posts that matched my challenge and still am no further forward. It is so easy in every other DB I have used and I am getting very frustrated.
    Perhaps someone could explain it to me simply.
    My challenge is I am importing a CSV File with the following format:
    Date: YYYY-MM-DD
    Description: 72 Characters
    Amount: 9.2 Numeric

    I use the import wizard and it creates a table with date and description as character fields and Amount correctly as Numeric 9.2.

    Now I want to update the table or append to another table and have the date in a date format. How do I do that simply?
    Liahona

    Newbie, learning the value of having no hair to pull out

    #2
    Re: Newbie - CSV Import challenge

    For me the easy way would be to create a new field in the table as a date type. then we need to convert the character date to a real date. As you are manipulating a character field, open the help file and click the second tab "Index" and search for "character". Items under character will reveal "functions". We will need some kind of function to do the conversion. Now double click on "functions" and in the right hand side of the help you will find "Character Conversion Functions". Double click on that and you should find CTOD() and open it to read all about it. CTOD() needs the data in a particular format MM/DD/YY so your original date need to be altered to do this. To make a long story short:

    CTOD(mid(yourdate,6,2)+"/"+mid(yourdate,9,2)+"/"+mid(yourdate,3,2))

    There is your equation to convert your dates. You can open the interactive window to test all this out. To convert all your dates in the table, you will need to create an operation to UPDATE the new field that you created above.

    HTH

    Comment


      #3
      Re: Newbie - CSV Import challenge

      A slightly shorter expression is
      Code:
      stod(remspecial(datestring))
      Consider the following from the Interactive window
      Code:
      dim datestring as C
      datestring = "2008-11-14"
      
      datestring = remspecial(datestring)
      ?datestring
      = "20081114"
      
      dim newdate as D
      newdate = stod(datestring)
      ?newdate
      = {14/11/2008}
      
      ?stod(remspecial(datestring))
      = {14/11/2008}
      If you type in the index 'date' (of all things :)) you get lots of entries on the subject including an entry called functions where you can find the stod().
      The remspecial you can find in the section Doug pointed you to.
      Tim Kiebert
      Eagle Creek Citrus
      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

      Comment


        #4
        Re: Newbie - CSV Import challenge

        Thanks guys,

        After two evenings of reading and getting nowhere I have managed to accomplish the simple transfer of 111 records.

        I bet my clients are glad they aren't paying for my learning curve.

        Since transferring and updating records is such a common function in DB development I am astonished it isn't covered more clearly in any of the training I have seen.

        Now that I know a couple of ways to do it, it shouldn't hold a challenge to me in the future.
        Liahona

        Newbie, learning the value of having no hair to pull out

        Comment


          #5
          Re: Newbie - CSV Import challenge

          I am trying to do something similar, but with a few added problems...
          Firstly, I have no control over the format of the date string contained in the csv file, which makes this conversion more difficult.

          The format is:- DayMonthYear, but could be any of the following:-
          112008 (1st Jan 2008)
          1112008 (1st Nov 2008)
          11112008 (11th Nov 2008)

          Anybody got a formula to convert this to a valid date ?

          Thanks

          Comment


            #6
            Re: Newbie - CSV Import challenge

            Hi Fred,

            This would have to be done by a logical process.

            My method which may not be the best but it can be seen to work is as follows. After importing, modify the structure with 4 new fields.

            Day, Month, Year, New_Date

            First of all you know that the last 4 digits will always be the year. So this field can be filled using Operation, Record Update with the expression:

            right(alltrim(old_date),4)

            By knowing the length of the old_date string using the function Len() with Alltrim() as in len(alltrim(old_date)) you can now test what month it is. If the Len is 7 or 8 then you will know that the month must be 10, 11, or 12.

            To extract the month from the old_date string you will need to use the Substr() function. The starting position will depend on the length. If the length is 7 or 8 then the starting position will be Len()-5 or Len()-6

            To get the Day you will need the Left() function, again this will depend on the length, if the string is 6 then it will be Left(old_date,1), string length of 7 will be Left(old_date,2)

            Lastly update the New_Date field with value {Day/Month/Year}

            All this can can all be written into a script and variables used instead of having the Day, Month and Year fields.

            I suggest you have a play in the interactive window with the above functions and the IF() function. It will be a good experience for you.

            Dont pull you hair out, take it step by step, it will work.
            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


              #7
              Re: Newbie - CSV Import challenge

              Hi Keith, thanks for that.
              I still think there is a problem here Keith...

              Regarding using the function Len() with Alltrim() as in len(alltrim(old_date)), there still could be 2 differant dates with a Len of 7.
              1112008 could be either 1st Nov 2008 or 11th Jan 2008.
              Same problem with working out the Length of Day.

              Fred

              Comment


                #8
                Re: Newbie - CSV Import challenge

                Fred,
                Whenever there is a problem in which a Person cannot tell what is going to be the end result, there will be no way to tell a database what to do about it---you are going to have to determine this one way or another manually. A perfect example too of why strict control in an application for data entry is so necessary.
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Newbie - CSV Import challenge

                  Hi Fred,

                  I accept
                  1112008 could be either 1st Nov 2008 or 11th Jan 2008.
                  could be a problem. So could 211208. Without going through the whole calendar, how many other instances could there be like this?

                  Filter out the 1112008 and do them manually. If this is an ongoing situation then as Mike says, consider data entry control.
                  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


                    #10
                    Re: Newbie - CSV Import challenge

                    Hi Mike, yep your correct in your assumption. There is no way of correctly calculating the date from a date string formated like that.
                    I am extracting this csv file directly from a POS terminal itself, so all I can do is create the additional fields as Keith suggested, and then create a formula to compare the results of these fields with today's date. If the dates are within lets say 7 days, I think I should be able to get an accurate result. Not ideal, but it's the best I can do on this.

                    Thanks for your input.

                    Comment


                      #11
                      Re: Newbie - CSV Import challenge

                      If you are truly getting data with the zeros missing from the day and month, then you may be hooped.

                      1112008 -> Jan. 11 2008
                      1112008 -> Nov. 1 2008

                      If your data is coming to you in chronological order, then you could create a parsing routine that could logically attempt to determine the dates from the previous ones and the later ones. Tough logic but not impossible. Otherwise, when there can be duplicate dates like above, there is no routine that can automatically correct your data.

                      Comment


                        #12
                        Re: Newbie - CSV Import challenge

                        Hi Keith, I looked at the calendar regarding these "dual" formatted dates occurances, and I think this idea will work better than my last date comparison idea.
                        I will give this ago.

                        Thanks again

                        Comment


                          #13
                          Re: Newbie - CSV Import challenge

                          Hi Doug, yeah I was thinking along those lines.

                          I blame the guys who write the software for these touch screen terminals.
                          No consideration for us 3rd party develops eh...haha

                          Cheers mate.

                          Comment


                            #14
                            Re: Newbie - CSV Import challenge

                            Just a wild shoot maybe:

                            1) load the csv file into excel using delimited field by character option
                            2) Check the date format with the original source and correct where needed (assuming these are manageable numbers)
                            3) load this into Alpha
                            Last edited by rleunis; 11-18-2008, 04:02 PM.

                            Comment


                              #15
                              Re: Newbie - CSV Import challenge

                              Hi Ron. Unfortuately I have to import the file silently, so editing it in Excel would not be an option.

                              Thanks for your suggestion.

                              Comment

                              Working...
                              X