Translator vs Cell Decorator in hybris, which one is preferred in what situation - sap-commerce-cloud

I know how to write and use Cell Decorator and Translators during impex imports
in hybris, However, I am not sure when the one is preferred over the other?
For example, I have used Cell Decorator to change the value of an attribute slightly like if a customer is from US I will append an '_US' at the end of customer number while inserting in the DB.
Similarly, I have used Translator when I need to find a status of a product Available/Out of stock based on product ID.
However, I am not 100% positive is this the only differentiation.
Any explanation with example will be appreciated.

What is a translator?
(from SAP documatentation):
A translator class is a converter between ImpEx-related CSV files and values of attributes of Hybris Commerce items
The translator is a "converter" it is used when you need to modify your data into some other kind of data.
What is a decorator?
(From Wikipedia)
The decorator pattern is a design pattern that allows behavior to be added to an individual object, dynamically, without affecting the behavior of other objects from the same class
What should be used in hybris
For Impex most of the time you want to use a translator because you want to use simple syntax in the Impex file and convert( ie. translate/modify) it to the target format using code.
When you need to add functionality to an existing feature use a decorator. It can be used in Impex too if you want to add data.
For example you can read the Wikipedia article for decorator, in hybris you can look at ChineseLogisticCellDecorator. For translators, you have the list in hybris documentation (mentioned above)

Related

How to use create a Custom class to format phone number in Google Speech-to-Text api?

I'm using Google Speech-to-Text api in order to transcribe phone calls in Hebrew.
Most of the phone calls contains customers that tells their phone-number, can I make some custom class in-order to format these numbers with the correct way?
Other example can be formatting an order-id which has a specific format.
I've read this article https://cloud.google.com/speech-to-text/docs/adaptation-model#custom_classes which tells that it can be a list of items...
What is the difference between class & phrase list?
PhraseSet indeed contain field phrases which is list of Phrase objects. The object contain two fields: value and boost (reference).
Now, in field value, is the phrase itself and is string. But instead of string value you can define and use CustomClass there, which in fact is a list of phrases (reference). So it works, when you want to add the same boost value to whole list of items. Example from the documentation mentioned by you is one of the best:
For example, you want to transcribe audio data that is likely to
include the name of any one of several hundred regional restaurants
Without custom class you would have to add all hundred names with seperate boost value. Instead you can create a list of values using CustomClass and assign one boost value for all of them. Additionally CustomClass can be managed independently to PhreaseSet.

Kentico 12 Azure Search

I'm trying to implement Azure Search on Kentico 12. Following the article below.
https://docs.kentico.com/k12/configuring-kentico/setting-up-search-on-your-website/using-azure-search/integrating-azure-search-into-pages
However, I have multiple indexes defined on the smart search not just a single index code name that I can hard code and also cannot aford to hard code index fields. Is there any tutorial out there that I can follow?
It sounds as if you're referring to building an Azure Search web part, is this correct. If so, make a property in your web part which allows you to select the code name from a list in the database. Secondly, regarding field names, you should be using generic field names like DocumentName, NodeAliaspath, etc. Although if you have very specific search results that need to be displayed, simply put in a switch statement to get the field names based on a class name.

how do i correctly set up a parameterized information link in spotfire?

Also posted on super users:
I'm a spotfire novice trying to create a parameterized info link. Ultimate goal is to create a default template that may be customized to return specific rows in a very large table. I've not been able to cobble together enough information from online searches to get me from point A to Z.
Spotfire version is 7.11 on an Oracle 11.2 SE DB.
Currently I've got a date/time prompt in the info link that will be global to all users. What I need is to be able to further filter to 1 of 2 columns (one is real, the other a string) in order to minimize loading times. There are 17 other on-demand tables that are related to the main one. Limiting the initial query will greatly speed up performance.
In information designer for the information link, if I edit the SQL in the WHERE and explicitly define the value or string for the column, I get the rows I want. When I try to define it using an input parameter (?ParamName), I either get nothing when I reload or get asked to input a parameter "for testing".
Q1: In the document properties for the analysis, I've been adding in properties that I assume is supposed to get picked up by the query.
- What part do scripts play in passing this variable to the SQL?
- Do I just need to define a value for a property name or include a IronPython script? - If script is required, can I just define the parameter to pass?
Q2: In the info link SQL, what is the correct syntax for defining the parameter variable depending on the type (real v string)? If I use a string, I need to include LIKE in order to pick up the desired rows. If I use a real, is it possible to define it as a list of values?
Thanks in advance.
Though not exactly clear from your description, I think you should be able to accomplish your goals using the "Load on demand" dialog that is accessed either when you add your data table to your analysis, or subsequently using the Data Table Properties>Type of Data>Settings dialog.
Spotfire uses this dialog to dynamically modify your SQL. Thus, you do not need to explicitly include the LIKE statement in your SQL. Spotfire will add it in based on what you define in the On-Demand settings. For example, you could have an Input Field where you type a constraint that will be stored as a Document Property and then refer to that Document Property in your On-Demand settings to control the table loading.

SharePoint Document Library Column Advice Needed for a Multiple Value Field

I created a basic OOTB document library to store Word and PDF files. I have been tasked to also create a few columns to store some basic metadata about the uploaded documents, for example: AuthorFirstName, AuthorLastName, and a column that lists "topics" discussed in the document.
While I am generally familiar with most Document Library settings, and creating columns, I am seeking information on what column datatype might work best for "topics". In most situations, one uploaded document would have 1-4 topics.
I would rather the datatype not be a single line of text datatype, as I would rather not ask the user to separate the different values (topics) using a delimiter such as a comma or semicolon. I would like to offer users the option to sort or filter in the SharePoint views.
There also seem to be some limitations with the Choice datatype.
While Choice fields seem to support Fill-In Values, when a choice is not pre-populated, they only seem to allow 1 fill-in. I would like the user to able to use a repeating-table-like interface to add a topic, and click an "add" button, and repeat, and so on.
I think in your scenario the best approach would be using managed metadata feature (http://office.microsoft.com/en-us/sharepoint-help/introduction-to-managed-metadata-HA102832521.aspx). It allows you to sort/filter library items, allows users to add new terms into metadata storage, etc.
Using a Lookup field to a custom List is something worth considering. The main advantage is that your data choices are stored separately from the main list and are easier to track and manage. The disadvantage is that you cannot easily have the user add a fill-in option as you desire. You would have to have a link from the library or the upload form to the options list where they would enter a new option separately from tagging it on the document.
Managed metadata is certainly an option as well, but it requires more overhead and sorting/filtering on that is a little trickier. Using a Lookup column is simple, although it does not meet all of your needs.

Extending Orchard Search and Indexing

We need to provide search options for users to find content based on specific field values.
We're developing a Training Course module for a client but the standard search looks for the text in any indexed field. We want to allow users to find courses based on searches against specific fields (i.e. Course Type, Location, Price, Date).
We've extended the search to check against specific fields but can't work out how to get the URL parameters passed by the Search form as a GET.
Where does Orchard put URL parameters?
Also, are we missing something, is there a way that Orchard already supports this that we haven't realized?
I would suggest you to copy part of the Search module, more specifically the Controller and the View and then modify it to suit your specific needs. I see you are actually modifying the original module, but this might be a problem on the long term, for instance if we start updating the module you might either lose you changes or have to reapply them to the code base. In the end you will target a MySiteName.Search module. And you can also add custom routes, custom settings.
On a side note the Search API is really powerful and you can even use it to do faceted search, or search on inherited taxonomy terms, tags, full text, ranges, ... Having your own controller code will let you use all of these features easily.

Resources