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

How do you export an image field

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

    How do you export an image field

    Hello,

    I was wondering if there is anyway to export a jpeg image field. I have an Export button which exports my table to an Excel file. Unfortunately when it does this the Image field becomes text as well.

    I have an import button which reads in the exported excel file. However because the image field was saved as text it doesn't get imported.

    The purpose behind the export and import is so that I can use the same database program on my laptop as on my desktop and merge the records. Please note that the import and export buttons XBasic code was taken from an Export and an Import operation.

    Is there perhaps another way to merge databases, so that all of the fields will be merged not just the text fields?

    Thanks,
    Andrew Hastings

    #2
    RE: How do you export an image field

    JPEG data is stored in the table as uuencoded text and that is what you are seeing. I can give you a number of ways to write that data to disk. Perhaps you can then use an excel macro to display it.
    Aaron Brown
    Alpha Software Development Team

    Comment


      #3
      RE: How do you export an image field

      Hi Aaron,

      Since Jpeg information is stored as uuencoded text could it be that I am not allowing for enough characters on the export and import commands to capture the entire picture and that is why it doesn't get imported?

      Thank you for explaining how the image is stored. I had no idea that it was stored like that.

      Thanks again!
      Andrew

      Comment


        #4
        RE: How do you export an image field

        I tried increasing the size of the character field I'm importing to the max, 100. However, I still cannot get the image file to import.

        I've copied the Xbasic code form the export and import button below.

        Export Button (onPush):

        xbasic_code = UI_YES_SELECTED then
        end
        end if
        end if
        'Fields from one-many child tables have been selected for export. This flag controls
        'whether A5 exports just one instance of each parent record, or one parent record for each
        'one-many child record.
        export.fetch_parent = .f.

        table.reset("kappa_set1.set")
        a_tbl = table.current()

        DIM a5_operation_order as C
        a5_operation_order = ""
        query.order = a5_operation_order
        DIM a5_operation_filter as C
        a5_operation_filter = ".T."
        query.filter = a5_operation_filter
        query.options = "I"
        query.Description = "Temporary Query"
        i_indx = a_tbl.query_create()

        export.type = 4
        export.names = .T.
        export.file = export_filename
        export.options = ""
        export.field_sep = ""
        export.record_sep = ""
        export.fields = 8
        export.field1 = "kappa->entry_num"
        export.field2 = "kappa->date_added"
        export.field3 = "kappa->subject"
        export.field4 = "kappa->keywords"
        export.field5 = "kappa->description"
        export.field6 = "kappa->phone_num"
        export.field7 = "kappa->image"
        export.field8 = "kappa->url"


        'Prompt for confirmation before running the Operation.......
        dim rec_count as n
        rec_count = a5_get_records_in_query("kappa_set1.set",a5_operation_filter)
        message_text = rec_count + " record(s) will be exported from 'kappa_set1.set', to '"+export_filename+"'."+crlf(2)+ "OK to proceed?"
        operation_result=ui_msg_box("Export Operation",message_text,UI_OK_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL)
        If operation_result ui_ok_selected then
        end
        end if

        a_tbl.export()

        'Display a dialog box showing the results of the Operation
        a5_export_op_result(a_records_processed, export_filename)


        %code%

        evaluate_template_private(xbasic_code)

        Import Button (onPush):


        temporary_import_table = file.temp_path_get()+ "kappa_temp_table.dbf"
        import_destination_table = "kappa"

        import_filename = ui_get_file("File to Import", "Excel (*.xls)","kappa.xls","X")

        if file.exists(import_filename) = .f. then
        ui_msg_box("Error","File to import not found: '"+import_filename+"'.",ui_stop_symbol)
        end
        end if

        import.type = 3
        import.names = "use"
        import.file = import_filename
        import.db = temporary_import_table
        import.skip_lines = 0
        import.skip_bytes = 0
        import.field_sep = ""
        import.record_sep = ""
        import.text_qualifier = ""
        import.record_len = 10954
        import.rem_blanks = .F.
        import.escape_newlines = .F.
        import.fields = 8
        import.field1 = "entry_num,n,0,4,0"
        import.field2 = "date_added,d,1,8,0"
        import.field3 = "subject,c,2,69,0"
        import.field4 = "keywords,m,3,10,0"
        import.field5 = "description,m,4,10,0"
        import.field6 = "phone_num,c,5,15,0"
        import.field7 = "image,c,6,100,0"
        import.field8 = "url,c,7,100,0"
        import()

        'Prompt for confirmation before appending the records that were imported into the temporary table.......
        dim rec_count as n
        rec_count = a5_get_records_in_query(temporary_import_table, ".t.")
        message_text = "Up to " + rec_count + " record(s) will be imported into '"+import_destination_table+"'."+crlf(2)+ "OK to proceed?"
        operation_result=ui_msg_box("Import Operation",message_text,UI_OK_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL)
        If operation_result ui_ok_selected then
        end
        end if

        a_tbl = table.open(import_destination_table)
        append.t_db = temporary_import_table
        append.m_key = "SUBJECT" '-PHONE_NUM
        append.t_key = "SUBJECT" '-PHONE_NUM
        append.m_filter = ""
        append.t_filter = ""
        append.type = "Unique only"
        append.m_count = 8
        append.m_field1 = "ENTRY_NUM"
        append.m_exp1 = "@kappa_temp_table->ENTRY_NUM"
        append.m_field2 = "DATE_ADDED"
        append.m_exp2 = "@kappa_temp_table->DATE_ADDED"
        append.m_field3 = "SUBJECT"
        append.m_exp3 = "@kappa_temp_table->SUBJECT"
        append.m_field4 = "KEYWORDS"
        append.m_exp4 = "@kappa_temp_table->KEYWORDS"
        append.m_field5 = "DESCRIPTION"
        append.m_exp5 = "@kappa_temp_table->DESCRIPTION"
        append.m_field6 = "PHONE_NUM"
        append.m_exp6 = "@kappa_temp_table->PHONE_NUM"
        append.m_field7 = "IMAGE"
        append.m_exp7 = "@kappa_temp_table->IMAGE"
        append.m_field8 = "URL"
        append.m_exp8 = "@kappa_temp_table->URL"
        append.t_count = 0
        a_tbl.append()

        a_tbl.close()

        ui_msg_box("Import Results","Records Read: "+a_records_total+" Records Imported: "+a_records_processed,0)

        'In case the destination table is not already in the Database, add it...
        file_add_to_db(table.filename_get(import_destination_table))
        'If the Operation is run from within a Form or Browse, then refresh the window
        if is_object(topparent.this) then
        if topparent.Class() = "form" .or. topparent.class() = "browse" then
        topparent.Refresh_layout()
        end if
        end if

        Thank you,
        Andrew Hastings

        Comment


          #5
          RE: How do you export an image field

          Andrew

          A bitmap is actually saved in a memo file format and can not be exported as character. I amm not sure if there is any method to export memo data.

          Jerry

          Comment


            #6
            RE: How do you export an image field

            Andrew,

            A uuencoded version of even a small image file is well over 100 characters. I doubt that you'll be able to store them directly in your spreadsheet.

            Here's a little Interactive Window session to demonstarte:

            f=file.open("C:\WINDOWS\Zapotec.bmp",FILE_RW_SHARED)
            raw_image = f.readb(f.bytes_get())
            f.close()
            uu_image = uuencode(raw_image)
            ?len(uu_image)
            = 13333.000000

            But what has me really confused is if you have Alpha Five on both your laptop and desktop systems, why are you converting to Excel at all just to transfer data between the two?

            -Lenny

            Lenny Forziati
            Vice President, Internet Products and Technical Services
            Alpha Software Corporation

            Comment


              #7
              RE: How do you export an image field

              Hi Larry,

              What I was trying to accomplish by exporting the databases to an Excel file was a method of combining the two, the one from my laptop and the one from my desktop. When I'm on travel I use my laptop, so it will have some entries that my desktop does not have. Vice versa for when I'm in the office. This really is an effort to have all of the data the same on both my desktop and laptop.

              So I thought the easiest/only way to do this would be to export the data from one into a file. Transfer that file to the other and then import it. If there is another way to do this I'd be more than willing to give it a shot. (As this method doesn't seem to be working as well as I'd had hoped.)

              Thank you,
              Andrew

              Comment


                #8
                RE: How do you export an image field

                You can simply copy the DBF (and related files) for each of your tables from one computer to the next and then append unique. You could alternatively transfer the file back and forth and always work from that one file and not have to merge them.

                -LENNY

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment

                Working...
                X