5 Replies Latest reply: Feb 25, 2013 7:00 PM by Donald Hutchins RSS

    Show the right picture...

      Hi all,

      this is my situation (see attachment).

       

      My QV contains 2 tables:

      1. the products

      2. the list of the pictures (jpg) which exist in a specific folder on the server.

       

      This is the products table:

       

      products.jpg

      I need to show a picture beside every product and I have to choose the right picture for every record of the products table as follows:

      1. the picture named "ModelPartColorCode.jpg", if it exists and it is present in the pictures table

      else

      2. the picture named "ModelPartCode.jpg", if it exists and it is present in the pictures table

      else

      3. the picture named "ModelCode.jpg".

       

      I really can't find a way to do that...

      too bad that the filesize() and filetime() functions can't be used in chart expressions but only in the script module...

       

      Thank you for your help.

       

      Roberto

        • Re: Show the right picture...

          I don't quite follow your logic for where the images are stored for each model, part, etc.  You mention specific filenames, but it appears that your Pictures table has filenames that are named for each model or part.  If this is so, then you can add a model or part column to your Pictures table, then use an INFO LOAD to load the picture file references.  Then in your chart properties, for the dimension, click Advanced and select Info as Image.

            • Re: Show the right picture...

              Hi Donald, thank you for your reply.

               

              I tried with INFO LOAD but the thing is that for every single product I have to check if 3 pictures exist in the filesystem.

              It takes 15 minutes for every 10.000 products, and we have more than 150.000 at the moment, increasing of 20.000 every year.

               

              Instead, loading at once a table with the filenames of all the pictures takes only 5 minutes.

               

              This is why I would like to find a way to match the 2 tables as I explained in my first post.

               

              I hope someone can help me.

               

              Thank you,

              Roberto

                • Re: Show the right picture...

                  Roberto,

                  It should not be that slow.  I just created a sample that recursed all my folders and loaded every image on my desktop's local drive.  For this machine, that's +28,000 images.  I loaded all the specifics (folder, filename, ext, size, time) to a resident table, then did an INFO load afterwards from the resident table.  The entire load took <45 seconds, and the INFO load was nearly instantaneous (less than a second).

                   

                  For your application, you should be able to just load a resident table with all your picture files, and then do an INFO load where the first column is the filename (without the ext) and the second column is the full file spec (path and name).  Regardless of whether it is ModelCode, ModelPartCode, or ModelPartColorCode, the filename is the actual code value (with .jpg ext), so this should work nicely.

                   

                  What am I missing?  Are you saying that you can load a table in <5 minutes with all images, but then doing an INFO load to load key and imagefilespec from that Resident table is subsequently very slow?

                    • Re: Show the right picture...

                      Hi Donald, thank you for your reply.

                       

                      I don't understand what you are suggesting.

                      I have 2 resident tables:

                      1. modelcode, modelpartcode and modelpartcolorcode

                      2. filename, full path, filetime, filesize of all my pictures.

                       

                      How would I construct the INFO LOAD statement to have the full path field in the first table?

                       

                      thank you,

                      Roberto

                        • Re: Show the right picture...

                          Your INFO table will have only two columns.  The first column is the key with which you identify or associate the record.  The second is the full filename with path to your .jpg image file.

                           

                          In your case, you have 3 types of image files you want to load:  Model, Model Part, and Model Part Color. So if you have all the images loaded to a Resident table, that's fine.  And it looks like your 'File Name' in this table is essentially the Model, Model Part, or Model Part Color code.  So I gather the Model Part Color Code ABC123 has a corresponding image file named ABC123.jpg.  An INFO LOAD to load images for these would typically look something like this:

                           

                          INFO LOAD

                              [File Name] As ColorCode,   <- this is the key to assoc. w/ your data model

                              [Full Path]

                          RESIDENT MyImagesList;

                           

                          Notice how this table has only 2 columns, and the first is named the same as your ColorCode in your data model.  The Full Path is the full file spec to the image file.

                           

                          You'll do this twice more, and it'll be the same INFO LOAD except [File Name] will be named PartCode, then ModelCode (or whatever your names).

                           

                          You can put multiple INFO LOADs in the script, one after another.  No need to Concatenate (it will not allow), and you won't actually see these tables in your Table Viewer.

                           

                          Finally, it appears each of the 3 types of images probably can be distinguised by the length of the file name?  If so, or maybe you have some other way of knowing for each file in your Resident list the type of image file, then you can add WHERE conditions to each of the Info Loads.  So you can Load ColorCodes only when the lenght of the filename is = 14 (or whatever).