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

AlphaDAO Import

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

    AlphaDAO Import

    Hi,

    I am importing data from a user selected Excel file via AlphaDAO
    On my development machine it creates the following data types when importing the data to the dbf file:
    1. chr
    2. exponentnumeric
    3. exponentnumeric
    3. chr
    4. chr

    Based on the above settings, everything is working fine.

    When I test the exact same thing on 2 other machines with the same excel file the data types created in the dbf files are:
    1. chr
    2. chr
    3. chr
    3. chr
    4. chr

    causing a "field and expression types must match error" when starting the append operations.
    I have tried to overwrite the data type settings in the "local table field defenition" on the AlphaDAO settings, also no luck.

    I have also tried to change the data type in the excel file with this code - also not working:
    Code:
    Dim xlApp as p 
    xlApp = ole.create("Excel.Application") 
    xlApp.Workbooks.Open(vFileName) 
    xlApp.Columns("A:I").Select()
    xlApp.Selection.NumberFormat = "@"
    xlapp.DisplayAlerts = .F. ' XL will not display warning regarding overwriting file
    xlApp.ActiveWorkbook.SaveAs(vFileName)
    xlApp.Workbooks.Close()
    xlapp.DisplayAlerts = .T.
    xlApp.Quit()
    Is there another way I can make sure the imported data from the Excel files are either all chr fields, or the field types as mentioned at the beginning.

    I really need a consistent import operation, as the user are importing loads of excel files daily - all the same format.

    Any ideas please?

    Walter

    #2
    Re: AlphaDAO Import

    Walter

    Hi, how are you?

    Look at the ADO import operation and use the override field definitions to make sure that you get what you want.....

    regards
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.
    "Make it as simple as possible, but not simpler."
    Albert Einstein

    http://www.iadn.com/images/media/iadn_member.png

    Comment


      #3
      Re: AlphaDAO Import

      Hello Al,

      Good and you?
      This Excel import is getting the better of me the past day or so.

      I have tried the override, but am also getting the field type must match error.
      ""Error 1091 - Field types don't match
      while converting ResultSet to DBF table""

      Is there any other way I can "Force" the data types to all character maybe, without havng to change the Excel files??

      Regards
      Walter

      Comment


        #4
        Re: AlphaDAO Import

        Hi all,

        Managed to resolve the issue with a bit of work in the excel file itself.

        To convert a column to the correct format I did the following:

        1. Column values to text values:
        - Format the whole column to "text"
        - Go to the cell value, press "F2" then "Enter" on the keyboard. This will change the cell value to a text value.

        2. Column values to number value:
        - Create a new column and format it to number
        - add the number "1" in all the cells in the new column(copy and paste),
        - copy the data only from the "old" column(not the whole column, just the data inside the column)
        - use "Paste Special" to paste the data into the new column, and under the paste special properties, use "multiply". This would convert the values in the old column to NUMBER in the new column. The just remove the old column and save and import the data into Alpha.

        It is a bit tedious, but I have not been able to find another way to get consistent import results.

        Maybe there are much better ways out there, but it would help out if you are under pressure.

        Regards
        Walter

        Comment


          #5
          Re: AlphaDAO Import Excel and Text format

          Hi,

          I have experienced similar issues like Walter's. And have like him not found a quick solution other than pressing F2 and entering to ensure that a number is saved as text.
          What is strange is that the sheet is in text format, but yet alpha only picks up on the data that have a "green" corner in the upper left part of the cell.

          Has anyone found a quicker solution than having to press F2 and enter to ensure that the information is imported correctly into alpha. Some of my sheets have more than 3000 entries.

          Thanks
          Sed

          Comment


            #6
            Re: AlphaDAO Import

            Without getting into macros (and you could probably find some using google), I would:

            1) insert 2 columns next to the one I was converting
            2) use a function like TEXT to create a formula to convert the number to the format you want.
            3) Copy and paste that equation into the whole first column
            4) select that whole column of text, move my cursor to the start of the next column and do a PASTE SPECIAL and select Values
            5) Delete the first 2 columns

            HTH

            Comment


              #7
              Re: AlphaDAO Import

              Thanks,

              I'll give you solution a shot..... seems like it could be my last resort.

              Sed:

              This is what happened in the meanwhile before i noticed Doug Page's post w.r.t my dilemma

              FYI: ironically when i used the alpha import ado genie and "forced" the change of field type when importing the table i.e. forced the field type to character, only the data that did not have a "green corner" in the upper left of the cell was imported - so it's a no win situation.

              Comment


                #8
                Re: AlphaDAO Import

                Originally posted by Walter View Post
                2. Column values to number value:
                - Create a new column and format it to number
                - add the number "1" in all the cells in the new column(copy and paste),
                - copy the data only from the "old" column(not the whole column, just the data inside the column)
                - use "Paste Special" to paste the data into the new column, and under the paste special properties, use "multiply". This would convert the values in the old column to NUMBER in the new column. The just remove the old column and save and import the data into Alpha.
                Code:
                FUNCTION tonum AS L (filename AS C, column AS C )
                Dim xlApp as p 
                xlApp = ole.create("Excel.Application") 
                xlApp.Workbooks.Open(filename) 
                'xlApp.Visible = .T. 'comment this line out if you don't want to see Excel 
                lastrow = xlApp.Activecell.SpecialCells("11").Row
                xlApp.Range(column+"2:"+column+alltrim(str(lastrow))).Select() 'the "2" assumes a column text header (fieldname), 1 if not
                xlApp.Selection.NumberFormat = "0" ' choose your own
                for i = 1 to lastrow
                	xlApp.Range(column+alltrim(str(i))).Select()
                	xlApp.Selection.Value = xlApp.Selection.Value
                next i
                xlapp.DisplayAlerts = .F.
                xlApp.ActiveWorkbook.SaveAs(filename,33) '33 is a constant for Excel 4.0, dbf4 is 11
                xlApp.Workbooks.Close()
                xlapp.DisplayAlerts = .T.
                xlApp.Quit() 
                END FUNCTION
                There can be only one.

                Comment


                  #9
                  Re: AlphaDAO Import

                  Try this for the text columns.

                  Code:
                  FUNCTION totxt AS L (filename AS C, column AS C )
                  Dim xlApp as p 
                  dim myCell as c 
                  xlApp = ole.create("Excel.Application") 
                  xlApp.Workbooks.Open(filename) 
                  xlApp.Visible = .T. 'comment this line out if you don't want to see Excel 
                  lastrow = xlApp.Activecell.SpecialCells("11").Row
                  xlApp.Range(column+"2:"+column+alltrim(str(lastrow))).Select()
                  xlApp.Selection.NumberFormat = "@"
                  xlapp.DisplayAlerts = .F.
                  xlApp.ActiveWorkbook.SaveAs(filename,33) '33 is a constant for Excel 4.0, dbf4 is 11
                  xlApp.Workbooks.Close()
                  xlapp.DisplayAlerts = .T.
                  xlApp.Quit() 
                  END FUNCTION
                  There can be only one.

                  Comment


                    #10
                    Re: AlphaDAO Import

                    Thanks Doug,

                    Your fix works.

                    I have a question for Stan and his solution: Thanks for posting it, am I to include this function in my excel I suppose and not in Alpha? I'm quite green at coding in vbscript, am i understanding you correctly?

                    Thanks again
                    Sed

                    Comment


                      #11
                      Re: AlphaDAO Import

                      NO. Both Alpha udfs take a filename and a column designation as parameters. You supply those and Alpha will convert the data in the designated column to the desired type.

                      totxt("C:\temp.xls","B")

                      should open "C:\temp.xls" and change the values in column B to text

                      tonum("C:\temp.xls","A")

                      should open "C:\temp.xls" and change the values in column A to numeric.

                      Both could be inline xbasic on a button onpush event before an import was run.
                      Last edited by Stan Mathews; 10-16-2008, 09:09 AM.
                      There can be only one.

                      Comment


                        #12
                        Re: AlphaDAO Import

                        Thanks a lot Walter . Much appreciated. :)

                        Fantastic. Got it.

                        Sed

                        Comment

                        Working...
                        X