This method uses a simple one-field text file with three records and a master PDF file with two fields setup. The first field is used to receive the value from the variable data file. The second field will use a script that references the first field to match a value, and choose an image by name from the Assets area of the template.
You would need to set up the template as follows:
1) The Master PDF will have two fields defined as VariableField and ImageField.
2) VariableField set as a field Type of Text, data coming from a Variable Data File.
3) ImageField set as a field Type of Image, data coming from Field Scripting or Static Text.
4) All images should be uploaded to the Graphic Files area on the Assets tab of the template. For our example, the image files will be named ImageA.jpg, ImageB.jpg and ImageC.jpg.
5) The variable data file should be a simple text file with one column/field and three rows/lines with a single letter on each row: A, B, and C.
The VarialbeField will be receiving the value from the data file. The ImageField will have the script below assigned in the Field Scripting tab. (Make sure the Field Scripting tab has the script type set to VB Script.)
ifs(VariableField="A","ImageA","") & ifs(A=VariableField="B","ImageB","") & ifs(VariableField="C","ImageC","")
Each ifs statement has three parts: what value in what field to match, the result if it matches, and the result if it does not match. We removed the file extension from the name of the image file in the field script. Note that the part of the statement that indicates what will happen if it is not matched is blank in each instance of the ifs statement.
To continue to grow the script to include other values and images, add more images to the image picker and more values to the script, as shown below.
ifs(VariableField="A","ImageA","") & ifs(VariableField="B","ImageB","") & ifs(VariableField="C","ImageC","") & ifs(VariableField="D","ImageD","") & ifs(VariableField="E","ImageE.","")