Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, June 19, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Add picture file to Add Edit Product form in SLX V7
Ina Nortje
Posts: 57
 
Add picture file to Add Edit Product form in SLX V7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jun 07 12:43 PM
Good day,

I need to add a picture file to my Add Edit Products form in SalesLogix V7. I have created a custom BLOB field in the products table, and added a tab control to the Add Edit Product form because I had to add many extra fields to the product. Because the Add Edit Product form doesn't seem to be linked to a table in the way a data form is, I had to code all my new fields for adding and editing. At this point, I can successfully add and edit all my extra fields via the code on the Add Edit Product form, except for the image that has to be saved to the BLOB field. I have added an image control, command button and an OpenPictureDialog control. I added code to the command button to execute my OpenPictureDialog control. I tested the code, and I can browse for an image file, and when I select it, the image displays on the image contol. My problem now is saving this image to the database, and subsequently displaying the image from the database. I did the recertification training on the Internet, and there it states that you should use the BinaryStream property to link the image control to the database. The problem is that the Add Edit product form is not linked to a database table, and thus I cannot browse for the field in the table. I also see on the BinaryStream hint that it is not accessible through script. How should I go about in this case to be able to save the picture to and subsequently display the picture from the database?

Regards

Ina
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Add picture file to Add Edit Product form in SLX V7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jun 07 11:49 PM
Hi Ina,

This article will show you exactly what you need
http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=62

-Ryan
[Reply][Quote]
Ina Nortje
Posts: 57
 
Re: Add picture file to Add Edit Product form in SLX V7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 9:53 AM
Hi Ryan

Thanks very much. The article helped a lot! VERY well written and explained.

I have a few more questions relating to this, though.

1. When viewing the file from the database you write it to a temporary filename. I tested, and you have to specify it up to the file extension. For this reason, I had to change my filter to only allow for one file type. Is this the way to do it, or is there a way I can determine what the file types of stored images are?

2. Also related to the temporary container - if I only have one filename and it is a literal value, it will mean if more than one person is viewing the product pictures, they will overrride each other's file. My thoughts are to create a variable filename that will include the userid. Do you agree with this method?

3. I am thinking of setting the temporary container to "C:\temppicture.jpg" However (though it probably is very rare) it may just happen that some user won't have a C:\ drive. Is there any other way of displaying the picture without using the temporary file container?

3. Finally, the image sizes may differ, and in my testing I found that sometimes the images don't fit well into the area provided. The file I tried showed only about 1/2 fo the full picture. Firstly I tried just setting the Autofit property to True in design time. However, for some reason the image container then contracts to 0 height and width (probably because I only populate it after it is displayed), and then you cannot see the image. So what I tried next is to set the Autofit property to True just after I loaded the image using the code:
imgProductPicture.OpenPictureFromFile "C:\temppicture.jpg", False
imgProductPicture.AutoSize = True
Doing this the picture does look better, but it still doesn't fit completely (only about 3/4 of the picture shows)
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Add picture file to Add Edit Product form in SLX V7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 12:51 PM
Hi Ina,

1) It's been a while since I tested this, but IIRC, I could add a BMP, JPG, PNG, GIF, etc to the database, and then stread it all back to GenericFile.JPG and it would work fine. Give it a try. Otherwise you could save the file extension when the file is saved to the database originally and write it back to the same file type.

2) This wouldn't be an issue if all users are on their own PC's since obviously they won't overwrite each other, so I assume you're talking about in a shared server environment like over citrix or something? As long as you write the file to the temp path there's no problem. That is specific to each user logged on the machine. SLX has a built in function to get the path to the user's "personal data path" Application.BasicFunctions.GetPersonalDataPath. Using this to write the files won't cause any problems with multiple users.

3) See #2 above. Use Application.BasicFunctions.GetPersonalDataPath.

4) There's a couple of different things involved for image size. The size of the image control, the size of the container or form it is in, etc. Play with those to get the one that works the best for you. It might work well to guess of best standard size and then put it in a scrollable container so the user could scroll to see the rest of the image if needed.

-Ryan
[Reply][Quote]
Ina Nortje
Posts: 57
 
Re: Add picture file to Add Edit Product form in SLX V7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jul 07 2:16 AM
Hi Ryan,

Sorry for taking so long to finally reply. Just wanted to let you know that your suggestions were all right on the money!

Thanks a lot!

Ina
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/19/2025 8:28:57 AM