View Single Post
  #4  
Old April 21st, 2022, 06:21 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Issue with blank or no selection

Whoops I forgot to get the record from the external data field. Try this:
Code:
var externalDF = new ExternalDataFileEx("Competitor-ExDF.xlsx", "Excel");
var unique = function (value, index, self) {
  return value ? self.indexOf(value) === index : false;
};
var getResource = function (value) {
  var competitor = externalDF.FindRecord("CompetitorDropDown", value);
  if (competitor) {
    var competitorImage = externalDF.GetFieldValue(competitor, "CompetitorImage");
    if (competitorImage) {
      return Resource(competitorImage).content;
    }
  }
  return '';
};
return ["CP-Product-1-A", "CP-Product-1-B", "CP-Product-1-C"]
  .map(Field)
  .filter(unique)
  .map(getResource)
  .filter(String)
  .join(' ');
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote