Lookups are a beloved feature in our platform to translate text to other text without creating a large amount of Nodes. We just removed the last obstacles for using them fully in our platform. Read here how.
When do you need this?
With our lookups, you can create interpretations of your text data - assign an adjective to a color or an indicator of quality to a manufacturer. You can also translate text data fields from other languages - make “black” out of “noir”.
If you have a large number of translations like these to maintain, you don’t want to create a Case and Phrase Node for every single one. Instead, you create a Lookup Table and use it to look up your word and give back your desired output.
- You need a data field that contains strings (text)
- You need other text you’d like to translate the data field values to. It is not necessary to have a match for every data field value.
Here is how you use Lookups
- Create a Data Node, that reads the data you want to tranlate. Make sure it has the right Data Path and is of Data Type Text:
- Add a Lookup Table Node.
- Click on the Lookup Table Node and then in the right menu on EDIT TABLE
- Select languages (If you don’t have multiple languages, skip this step)
- Click on ADD LOOKUP
- Write one of your data values in the field “Key”
- Write the desired output of “Key” into the Fields next to it
- Repeat until all your values have an assigned ouptut
- Create a Mapping Node and connect the two Nodes from step 1 and 2 to it like this:
- Add the code get(#table,#key,#key) to the Mapping Expression - The Mapping Node should now preview a $phraseX
- Attach a Group Node and a Variable Node to the Mapping Node like this:
- The translated output is now available in the WRITE section via variable1
The first new function we created is get(#table, #value, “fallback”), which searches for value in table and returns the result. If table does not contain value, it returns “fallback”. In the above example we just returned the unmodified value, it can be any text or value though. As it is usually desired to return the value if no match in lookup was found, we also introduced the shorthand get(#table, #value) for get(#table, #value, #value).
The other function which is now available to you is has_voc(). It can be used to check if a Lookup Node delivered an output in the same way != “” works for simple text.
With these new additions we restored the full functionality of Lookups for the AX Next version. The functions are already available to you.