Share this link

    Home / Tradeshift Documentation / Tradeshift Partner Apps / Babelway / Chapter 4. Channels

    Edit Formula

    2072 0 Created on 2020-10-01 07:17:29; Last updated on 2022-07-01 13:01:13

    Formula bar

    By default, when you just make your mappings by dragging and dropping your source fields to the corresponding target fields, the values are associated without any transformation.

    

    Formula Bar

    For advanced users, the formula language is xpath, and you can use whatever xpath function to create your formula, even if it is not documented in the function library. Differences of pure xpath formula are:

    • You can refer to source fields by just dragging and dropping them in the formula (a summary of the node will be displayed).
    • All the documented functions, even the extensions specific to Babelway, can be called without a namespace prefix.

    Easy Function Editor

    Easy Function Editor can help you writing your formulas. It opens in two situations:

    • When you write a function call in the formula bar. And it shows you help of the function you are using.
    • When you click on the "Easy Function Editor" link, at the right of the formula bar. 

    In any case, the help relates to the cursor position, as it is about the called function at this precise cursor position. You can use both the formula bar or the Easy Function Editor to write your functions and their parameters. All changes you make in the editor panel are automatically and immediately reflected in the formula bar, and vice-versa.

    While typing a function name, the formula editor just shows all the functions in the library that match the prefix you type. You can select the proposal by just clicking on it. Then the name will be completed in your formula, and the editor will allow you to fill the parameters. You can also use the following keyboard shortcuts:

    • Enter: Select the currently highlighted proposal.
    • Down arrow: Select the next proposal.
    • Up arrow: Select the previous proposal.
    • Escape: Hide the function editor.

    

    

    Formula bar - choosing your function

    While defining the parameters of a function, the formula editor shows you all the documentation about the function (description, examples, ...), and allows you to easily define the parameters.

    

    

    Formula bar - filling parameters

    Whenever possible, the function editor shows additional help to allow you to easily define the function parameters. In the following example, using a lookup table, the editor will allow you to select your lookup table and its columns in a dropdown menu that its content depend on your environment.

    

    Formula bar - filling parameters

    Note: When you have used the lookup table name in the "lookupTable" field then the lookup table name was changed, the processed message will fail in error due to unknown lookup table name. But using the lookup table ID instead will process the message successfully then.

    Finally, When you are planning to duplicate channels from one environment to another then the best is to use the lookup table name in the lookup table function, And when you will use this channel in one environment only then you can use the lookup table ID in the lookup table function.

    The online help describes many functions, and helps you pick parameters for all of them. These functions mostly covers your needs. And should you need more search clarification, please do not hesitate to ask our support: support@babelway.com

    

    Formula bar - functions list

    Colorization of the formulas 

    To ease reading and error detecting of the formulas, they are colorized.

    

    Colorization of the formulas

    • Recognized function names are displayed in italic light blue.
    • String constants are displayed in dark blue.
    • Other elements of the formula are displayed in black.

    Validation of your formulas 

    If you want to be sure that your formula's syntax is correct (a valid xpath expression), you can click the validate icon at the end the formula bar.

    

    

    Validate formula

    If the formula is correct, the icon will become green.

    

    

    Validate formula - OK

     If not, it will become red, and a summary of the error will be available when you move the mouse on the icon.

    

    Validate formula - OK

    The validation is also accessible by just pressing the Enter key. 

    Deleting a formula

    To delete a formula, so that the target node is not mapped anymore, you can:

    • Empty the formula bar.
    • Click on the X icon at the end of the formula bar.

    

    

    Reset formula

    Note: The "Validate your formula" button only validate the formula's syntax and not the formula's value type of the parameters and arguments.


    

    

    0 people found this helpful.

    Related Articles