Skip to main content
Version: 20 R7 BETA

PICTURE LIBRARY LIST

PICTURE LIBRARY LIST ( picRefs ; picNames )

ParameterTypeDescription
picRefsArray integerReference numbers of the Picture Library graphics
picNamesText arrayNames of the Picture Library graphics

This command is not thread-safe, it cannot be used in preemptive code.

Description

The PICTURE LIBRARY LIST command returns the reference numbers and names of the pictures currently stored in the Picture Library of the database.

After the call, you retrieve the reference numbers in the array picRefs and the names in the array picNames. The two arrays are synchronized: the nth element of picRefs is the reference number of the Picture Library graphic whose name is returned in the nth element of picNames.

If necessary, the command automatically creates and sizes the picRefs and picNames arrays.

The maximum length of a Picture Library graphic name is 255 characters.

If there are no pictures in the Picture Library, both arrays are returned empty.

To obtain the number of pictures currently stored in the Picture Library, use the Size of array command to get the size of one of the two arrays.

Example 1

The following code returns the catalog of the Picture Library in the arrays alPicRef and asPicName:

 PICTURE LIBRARY LIST(alPicRef;asPicName)

Example 2

The following example tests whether or not the Picture Library is empty:

 PICTURE LIBRARY LIST(alPicRef;asPicName)
 If(Size of array(alPicRef)=0)
    ALERT("The Picture Library is empty.")
 Else
    ALERT("The Picture Library contains "+String(Size of array(alPicRef))+" pictures.")
 End if

Example 3

The following example exports the Picture Library to a document on disk:

 PICTURE LIBRARY LIST($alPicRef;$asPicName)
 $vlNbPictures:=Size of array($alPicRef)
 If($vlNbPictures>0)
    SET CHANNEL(12;"")
    If(OK=1)
       $vsTag:="4DV6PICTURELIBRARYEXPORT"
       SEND VARIABLE($vsTag)
       SEND VARIABLE($vlNbPictures)
       gError:=0
       For($vlPicture;1;$vlNbPictures)
          $vlPicRef:=$alPicRef{$vlPicture}
          $vsPicName:=$asPicName{$vlPicture}
          GET PICTURE FROM LIBRARY($alPicRef{$vlPicture};$vgPicture)
          If(OK=1)
             SEND VARIABLE($vlPicRef)
             SEND VARIABLE($vsPicName)
             SEND VARIABLE($vgPicture)
          Else
             $vlPicture:=$vlPicture+1
             gError:=-108
          End if
       End for
       SET CHANNEL(11)
       If(gError#0)
          ALERT("The Picture Library could not be exported, retry with more memory.")
          DELETE DOCUMENT(Document)
       End if
    End if
 Else
    ALERT("The Picture Library is empty.")
 End if

See also

GET PICTURE FROM LIBRARY
REMOVE PICTURE FROM LIBRARY
SET PICTURE TO LIBRARY