on ‎2018 Feb 06 7:21 PM
Hello,
We can write decorators and translators in the impex. What the difference between decorator and translator. I am always writing translators and I didn't get in what situations need to write the decorator and what situations need to write translators. Could you any one explain when to write translators and when to write decorators?
Thanks in advance.
Request clarification before answering.
A decorator is meant for changing the text of impex value to another text value before an Item has even been created.
A translator takes the text value (that may or may not have been decorated) and adds it to an Item.
Certainly you can do anything that a decorator is doing in your translator but the purpose of keeping them separate is so that you can chain them in different combinations.
E.g. in my (total contrived) example
You might have a decorator than appends the word TEST to all data in a column and that then gets passed to a translator. You can then decide to only specify the decorator when importing to your test environment but still use the same translator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response. I can do the same thing with translator also right? Using translator also I can decorate the format ( from 23-45-67-89 to 23456789).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Just for the understanding purpose and mentioned in wiki, both are different decorators and translator. Decorator comes between parsing and translating.
Decorators are created to modify the value for a specific attribute. For example We get group ID in some format and want to search using group ID in database where we need to pass the string, so first we parse Input attribute to string and in case we get a string like 23-45-67-89, we use the decorator to format it to 23456789.
This is where we can use Decorators , to modify attributes. Refer ContentUnitCellDecorator, ClassificationGroupIDCellDecorator for better understanding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Two examples where I used a decorator were: 1) To create a unique identifier by concatenating other values of the impex row with an undescore separator(Business requirement). 2) To derive the value of an attribute based on some business logic using other values of the impex row. Example where translator were used: 1) One of the most common is to use the OOTB password encoding translator specifying the desired encoding.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.