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

Calculated image field on report?

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

    Calculated image field on report?

    I am wanting to put a calculated image field on report? Is it possible?

    Any sample code?

    #2
    Re: Calculated image field on report?

    Not sure what your intent might be.

    You can choose to have an image on a form an have it loaded from a file. If you change the image by changing the file referenced on the form, the image on the form changes the next time the report is opened.

    IOW, image file name is c:\temp\abc123.jpg. If you go to the c:\temp directory and modify the image or save another image to the directory with that file name, that will be the image shown on the form.
    There can be only one.

    Comment


      #3
      Re: Calculated image field on report?

      You can also code the onprintinit event to set the name you want.


      topparent:bitmap_object_name.Bitmap.Filename = "c:\temp\gold-star-graphic small.jpg"
      There can be only one.

      Comment


        #4
        Re: Calculated image field on report?

        Great! Thanks. Here what I am thinking of doing.

        Since my parent record has multiple image records, I was thinking of updating the current table with the image data.




        Code:
        dim filename as C
        dim newfilename as C
        dim name_ext as C
        dim defdir as C = "L:\PRODUCTIMAGES"
        filename = ui_get_file("Select File", "jpg(*.jpg)", defdir +"\*.*")
        dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+"\\"+alltrim(imagesubcat.value)+"\\"+alltrim(vendor.value)+"\\"+alltrim(Famiily.value))
        newfilename = "L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+chr(92)+alltrim(imagesubcat.value)+chr(92)+alltrim(vendor.value)+chr(92)+alltrim(Famiily.value)+chr(92)+trim(imagesku.value)+"_1.jpg"
        file.copy(filename,newfilename)
        
        name_ext = file.filename_parse(newfilename,"NE")
        
        
        record_number = current_record_number()
        query.filter = "recno() = " + record_number
        query.order = ""
        
        
        dim tbl as P
        tbl_src= table.current(1)
        tbl_dest = table.open("productimages")
        	tbl_dest.delete_range("Productimagename="+quote(name_ext))
        	tbl_dest.enter_begin()
        	tbl_dest.id = imageid.value
        	tbl_dest.Productimagename = name_ext
        	tbl_dest.Productimageindv = image_filename_encode(newfilename)
        	tbl_dest.enter_end(.T.)
        	tbl_dest.close()
        Here I am updating the child table. But I would like to update the main table one field. Is my code correct?

        Code:
        dim tbl as P
        tbl_dest = table.current(1)
        	tbl_dest.enter_begin()
        	tbl_dest.Productimageindv = image_filename_encode(newfilename)
        	tbl_dest.enter_end(.T.)
        tbl_dest.close()
        Since I will be sitting on this record do I need to open the table again?

        Thanks for the help.

        Comment


          #5
          Re: Calculated image field on report?

          Still no clue what you're doing or what any of that has to do with a report.
          There can be only one.

          Comment


            #6
            Re: Calculated image field on report?

            Hi Stan:

            I think rather than having a calcuated image on report, I thought it would be better to update the parent image field when user is uploading images.

            This is how I am wanting to you but failing (red marks).

            I have a form where user upload images (code below). What I would like to do is update the parent image field when user load the first image.

            Code:
            dim filename as C
            dim newfilename as C
            dim name_ext as C
            dim defdir as C = "L:\PRODUCTIMAGES"
            filename = ui_get_file("Select File", "jpg(*.jpg)", defdir +"\*.*")
            dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+"\\"+alltrim(imagesubcat.value)+"\\"+alltrim(vendor.value)+"\\"+alltrim(Famiily.value))
            newfilename = "L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+chr(92)+alltrim(imagesubcat.value)+chr(92)+alltrim(vendor.value)+chr(92)+alltrim(Famiily.value)+chr(92)+trim(imagesku.value)+"_1.jpg"
            file.copy(filename,newfilename)
            
            name_ext = file.filename_parse(newfilename,"NE")
            
            
            record_number = current_record_number()
            query.filter = "recno() = " + record_number
            query.order = ""
            
            
            dim tbl as P
            tbl_src= table.current(1)
            tbl_dest = table.open("productimages")
            	tbl_dest.delete_range("Productimagename="+quote(name_ext))
            	tbl_dest.enter_begin()
            	tbl_dest.id = imageid.value
            	tbl_dest.Productimagename = name_ext
            	tbl_dest.Productimageindv = image_filename_encode(newfilename)
            	tbl_dest.enter_end(.T.)
            	tbl_dest.close()
            
            [COLOR="#FF0000"]dim tbl as P (This is parent table that is already open). 
            tbl_dest = table.current(1)
            	tbl_dest.enter_begin()
            	tbl_dest.Productimageindv = image_filename_encode(newfilename)
            	tbl_dest.enter_end(.T.)
            tbl_dest.close()[/COLOR]
            Here I am updating the child table. But I would like to update the main table one field. Is my code correct?

            Then I would be able to use the image field directly.

            Comment


              #7
              Re: Calculated image field on report?

              This did the job!

              Code:
              'Date Created: 14-Jan-2013 04:06:15 PM
              'Last Updated: 27-Feb-2013 12:26:54 PM
              
              dim filename as C
              dim newfilename as C
              dim name_ext as C
              dim defdir as C = "L:\PRODUCTIMAGES"
              filename = ui_get_file("Select File", "jpg(*.jpg)", defdir +"\*.*")
              dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+"\\"+alltrim(imagesubcat.value)+"\\"+alltrim(vendor.value)+"\\"+alltrim(Famiily.value))
              newfilename = "L:\PRODUCTIMAGES\\"+alltrim(imagecat.value)+chr(92)+alltrim(imagesubcat.value)+chr(92)+alltrim(vendor.value)+chr(92)+alltrim(Famiily.value)+chr(92)+trim(imagesku.value)+"_1.jpg"
              file.copy(filename,newfilename)
              
              name_ext = file.filename_parse(newfilename,"NE")
              
              
              record_number = current_record_number()
              query.filter = "recno() = " + record_number
              query.order = ""
              
              
              dim tbl as P
              tbl_src= table.current(1)
              tbl_dest = table.open("productimages")
              tbl_dest1 = table.open("merchandisedetails")
              	tbl_dest.delete_range("Productimagename="+quote(name_ext))
              	tbl_dest.enter_begin()
              	tbl_dest.id = imageid.value
              	tbl_dest.Productimagename = name_ext
              	tbl_dest.Productimageindv = image_filename_encode(newfilename)
              	tbl_dest.enter_end(.T.)
              	tbl_dest.close()
              	
              	tbl_dest1.change_begin()
              	tbl_dest1.Pimage = image_filename_encode(newfilename)
              	tbl_dest1.change_end(.T.)
              	tbl_dest1.close()

              Comment


                #8
                Re: Calculated image field on report?

                Code:
                dim tbl as P [COLOR="#0000FF"][/COLOR][COLOR="#0000CD"]'unneeded line, tbl pointer is not used anywhere[/COLOR]
                tbl_src= table.current(1) [COLOR="#0000FF"]'unneeded line, tbl_src pointer is not used anywhere[/COLOR]
                tbl_dest = table.open("productimages")
                	tbl_dest.delete_range("Productimagename="+quote(name_ext))
                	tbl_dest.enter_begin()
                	tbl_dest.id = imageid.value
                	tbl_dest.Productimagename = name_ext
                	tbl_dest.Productimageindv = image_filename_encode(newfilename)
                	tbl_dest.enter_end(.T.)
                	tbl_dest.close()
                
                dim tbl as P (This is parent table that is already open). [COLOR="#0000FF"]'unneeded line, tbl_src pointer is not used anywhere and comment is not commented out[/COLOR]
                tbl_dest = table.current(1)
                	tbl_dest.enter_begin() [COLOR="#0000FF"]'do you want to enter a record or change the current record? this enters a new one[/COLOR]
                	tbl_dest.Productimageindv = image_filename_encode(newfilename)
                	tbl_dest.enter_end(.T.)
                tbl_dest.close()
                There can be only one.

                Comment


                  #9
                  Re: Calculated image field on report?

                  Hi Stan:

                  You are right. I am changing the record.

                  Here is the code i updated to:

                  Code:
                  tbl_src= table.current(1)
                  tbl_dest = table.open("productimages")
                  tbl_dest1 = table.open("merchandisedetails")
                  	tbl_dest.delete_range("Productimagename="+quote(name_ext))
                  	tbl_dest.enter_begin()
                  	tbl_dest.id = imageid.value
                  	tbl_dest.Productimagename = name_ext
                  	tbl_dest.Productimageindv = image_filename_encode(newfilename)
                  	tbl_dest.enter_end(.T.)
                  	tbl_dest.close()
                  	
                  	[COLOR="#FF0000"]tbl_dest1.change_begin()  [COLOR="#0000FF"]This only changes the 1st reocord. I need to match the id. [/COLOR]
                  	tbl_dest1.Pimage = image_filename_encode(newfilename)
                  	tbl_dest1.change_end(.T.)
                  	tbl_dest1.close()[/COLOR]
                  One major issue. The change is occuring only on the first record of parent.

                  How can I update the record matching the id?

                  Comment


                    #10
                    Re: Calculated image field on report?

                    Change this

                    tbl_dest1 = table.open("merchandisedetails")

                    to

                    tbl_dest1 = table.current(1)

                    and you will be changing whatever parent record is displayed.

                    Probably want a parentform.resynch() at the end to force the table fields to be refetched from the newly changed record.
                    There can be only one.

                    Comment


                      #11
                      Re: Calculated image field on report?

                      The following is in-fact the parent table. Also, it is the child of the another table.

                      tbl_dest1 = table.open("merchandisedetails")

                      Comment


                        #12
                        Re: Calculated image field on report?

                        It says property not found! "tbl.dest1.Pimage subelement not found."

                        Comment


                          #13
                          Re: Calculated image field on report?

                          Hi Stan:

                          this worked!!!!

                          Code:
                          tbl_src= table.current(1)
                          tbl_dest = table.open("productimages")
                          tbl_dest1 = table.current([COLOR="#FF0000"]2[/COLOR])
                          	tbl_dest.delete_range("Productimagename="+quote(name_ext))
                          	tbl_dest.enter_begin()
                          	tbl_dest.id = imageid.value
                          	tbl_dest.Productimagename = name_ext
                          	tbl_dest.Productimageindv = image_filename_encode(newfilename)
                          	tbl_dest.enter_end(.T.)
                          	tbl_dest.close()
                          	
                          	tbl_dest1.change_begin() 
                          	tbl_dest1.Pimage = image_filename_encode(newfilename)
                          	tbl_dest1.change_end(.T.)

                          I just changed 1 to 2.

                          Thanks for help!

                          Comment

                          Working...
                          X