Picture function in stock control
  • Guest
    Picture function in stock control

    by Guest » Wed Feb 22, 2006 5:44 pm

    Our product codes are 4-6 characters followed by a space and the colour eg: 1001 Blk and GI2216 Gold. For one product we may have upto 7 different colours.

    What i want to do is display a picture of the product in the stock control screen for easy visual reference. The picture could be one image but display in all the colour codes. (colour of picture for illustration is irrelevant) So if the code is GI2216 Blk or GI2216 Green I dont care if the image is in a different colour to the code, but I want the same image to appear in all the screens of GI2216 in stock control. The formula should be able to pickup the first few characters of the image filename. The image filenames are generally just the code itself eg. GI2216, so this filename should appear in the screens of the different colours.

    I am presently using this:
    PictureFileName:= "C:\PICS" + left(stock->name, 4) + ".bmp"
    This fails when the characters are more than 4. If I change it to read 6 characters then it reads the space and the first letter of the colour.

    Can a formula stop reading at the space which will do my job? if so can someone pls assist me. I am using Build: 10003-294h-SL0 (7.31f) 
  • COBS Tech Support
    Posts:683
    Joined:Fri Sep 09, 2005 8:23 am

    by COBS Tech Support » Wed Feb 22, 2006 9:43 pm

    Yes you can use the AT() function to search a character sequence for a matching code. If a matching code is found (in this case a space character), then the AT() function will return the position of that code in the character sequence. You can use the returned number to determine how much of the product code you need to extract.

    E.g.,

    If At(" ", Stock->Name) = 0
    PictureFileName := "c:\pics\" + Stock->Name) + ".bmp"
    Else
    PictureFileName := "c:\pics\" + Left(Stock->Name, At(" ", Stock->Name) - 1) + ".bmp"
    Endif
  • Guest

    Picture Function

    by Guest » Tue Mar 07, 2006 8:01 pm

    Thanks , that worked. But is there a way to select a default picture in case the file the script is looking for does not exist. This may happen where certain products do not have pictures.

Who is online

Users browsing this forum: No registered users and 10 guests