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

list control - how do I only show image if one saved in record?

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

    list control - how do I only show image if one saved in record?

    Hey,

    Thanks for taking a look.
    We have a list control that is pointing to a table. One of the fields in the table is a blob (image).
    How do I get the list control to only display an image if one was saved for that record?

    At the moment, the list will display the space for the image even if one wasn't saved for that record.

    Cheers

    Jane.

    #2
    Re: list control - how do I only show image if one saved in record?

    The easiest thing to do would be to put a default image in the blob - even if that default image is an image that says "no image".

    Alternatively, you could put a show/hide on the control's display. Something like controlname > ''

    However, I've had that not work for me before.

    You might have to add a Boolean field that you set to 1 if there is an image to display and 0 if there is no image. The do the show hide off of that field.

    Comment


      #3
      Re: list control - how do I only show image if one saved in record?

      There are so many variations concerning the List control and images. This example was built with a List, SQL source, BLOB field.

      The BLOB field, SheetImageThumb, in the List, has a Client-side inline style of width:300px;height:300px; This is just to make the control big to ensure we're getting what we want.

      As well, under Image Properties, Embed Image into HTML is checked.

      Using the List control event onItemDraw, we get access to each row as the List is put together. This code...

      Code:
      if(data.SheetImageThumb == null){
      	$('{dialog.ComponentName}.LISTIMAGES.SHEETIMAGETHUMB.IMG.'+index).style.display = 'none';
      }
      tests the data in the field and if it's null, will set the display of that field to 'none'. The only changes you'll need to make are to the List name (mine is LISTIMAGES) in 1 place and to the field name (mine is SheetImageThumb) in 2 places.

      When rendered, the ID of each image tag in the List is

      DLG1.LISTIMAGES.SHEETIMAGETHUMB.IMG.0
      DLG1.LISTIMAGES.SHEETIMAGETHUMB.IMG.1
      DLG1.LISTIMAGES.SHEETIMAGETHUMB.IMG.2
      etc.

      index is the zero based row number of the List... available in the event.

      Comment


        #4
        Re: list control - how do I only show image if one saved in record?

        Hey Larry - I like your suggestion and it would be preferred to not have a default image as the image upload will only be used rarely.
        Hey David - thanks for popping in. I like your thinking and started to do something similar.
        if(data.photo==null){
        var e = {listElement:photo};
        e.style.display = 'none';
        }

        The trouble is that for some reason it's not detecting that the photo field is null.
        Various methods have been tried such as data.photo=='', data.photo.length>0, data.photo.trim=='', String(data.photo).trim=='' and all of them are unable to perform.
        test_list_image.a5wcmp
        This is a test comp with our message. It's connected to a table:
        CREATE TABLE `messageboard` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `fk_company_id` varchar(40) DEFAULT NULL,
        `lu_created_by` varchar(100) DEFAULT NULL,
        `date_created` datetime DEFAULT NULL,
        `message` varchar(500) DEFAULT NULL,
        `photo` longblob,
        `voiceattach` longtext,
        PRIMARY KEY (`id`)
        ) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1;

        I really don't know what to try next! Any suggestions?

        Thank you muchly.

        Jane.

        Comment


          #5
          Re: list control - how do I only show image if one saved in record?

          UPDATE:
          Um, I'm not sure if it's politically/programatically correct but the way I've got around it is
          if (data.photo.length<100) {
          //set control to hidden
          }

          It seems the ones with pictures are coming back at 96, the ones with pictures are much bigger.

          Comment


            #6
            Re: list control - how do I only show image if one saved in record?

            This is where having a test case is so vital... so thanks for that... excellent. If you turn Pagination off in your List control, then the data.photo value will be null.

            So... if you really need pagination... then you have 2 choices...

            1. Compare data.photo to the known "empty" value of a paginated row. Which is...

            Code:
            "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4//8/AwAI/AL+eMSysAAAAABJRU5ErkJggg=="
            On my system, this is what a null blob value looks like when the List is paginated. It'll be interesting to find out if you're seeing the same value.

            Or... you could take a chance and figure that any image is going to be larger than say 200 bytes. Even the smallest image... a thumbnail is usually a few K in length.
            The length of a null, paginated, blob in a List row is 96.
            So...

            Code:
            if(data.photo.length < 200){
            should be true for a row with no photo.

            Yikes.

            Comment


              #7
              Re: list control - how do I only show image if one saved in record?

              *pleased* Aaahhh! David, I hadn't thought of that.
              Yes, mine returns the exact same "empty" value of a paginated row. "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4//8/AwAI/AL+eMSysAAAAABJRU5ErkJggg=="

              Great - thank you. That clarifies where I was heading and solves our problem.
              Thank you David.

              Comment


                #8
                Re: list control - how do I only show image if one saved in record?

                You'd already solved it. It was an interesting puzzle... I had to find out why and where the difference was.

                Comment

                Working...
                X