Ravi Gupta
Ravi Gupta

Reputation: 25

Unable to display common name from combobox bearing abbreviated names

I am retrieving values of combobox from @dblookup formula. This formula returns name values in abbreviated format. But, I want to display these name values as Common Names [CN] in combobox. But while saving to the document, the selected value should be saved in abbreviated format.

I tried accomplishing this task using custom converters, but all in vain. Is it possible to do through this way ? Please help !

Upvotes: 0

Views: 252

Answers (1)

Tim Tripcony
Tim Tripcony

Reputation: 8086

Selection fields (combo, radio, checkbox) support pipe aliasing. In your select items formula, loop through the @DbLookup results and turn each one into an aliased string:

var result = [];
var abbreviatedNames = @DbLookup(...;
for (var i = 0; i < abbreviatedNames.length; i++) {
  var eachName = abbreviatedNames[i];
  result.push(@Name("[CN]",eachName) + "|" + eachName);
}
return result;

The user will be able to select a common name, but the actual value stored will be the abbreviated name.

Upvotes: 6

Related Questions