Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Drop-down List values in Transformations View modes: 
User avatar
Member
Member
CC - 1/1/2012 2:16:26 PM
   
Drop-down List values in Transformations
I have a document type with a custom field Flavors, where the form control = Drop-down List and the data source is Options:
1;Banana
2;Apple
3;Grape

The data stored in the database is 1,2, or 3, but I want to display in my transformation the Banana, Apple, or Grape. I also want to localize the display text in the future, so I really cannot use the display text as the value as well.

I found (this post describing a couple of ways to do this. Has there been any update to how to do this? It seems like a very common requirement to display the display text rather than the value of a drop-down (or other multi-select) field.


User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 1/1/2012 6:55:20 PM
   
RE:Drop-down List values in Transformations
Hi,

You can use any text expression (for example some localization expression) as a value instead of integer based index. Example:

Banana;Banana
Apple;Apple
Grape;Grape

Thanks,
Miro

User avatar
Member
Member
CC - 1/1/2012 10:11:29 PM
   
RE:Drop-down List values in Transformations
That doesn't work, though, if i have a DataList that needs to filter on flavor (where Flavor = 'Banana'). If this field has been localized, I won't have an easy time of getting them all, because they'll be stored in the database differently. So I need a unique, indexable value for this additional functionality.

Perhaps a more common example of this would be a Status field:
1;Active
2;Pending
3;Closed

In my DataList I'd have a WHERE condition:
Status = 1

I can't do that if it's localized, can I?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/2/2012 1:31:28 AM
   
RE:Drop-down List values in Transformations
Hello,

you can use 1;Active and then create a custom transformation function where you can return the output for 1, 2 or 3 input value according to the current culture, or return a locallization key for 1, 2 or 3 and then evaluate it like: Resolving localization macros by API.


Best regards,
Helena Grulichova