Visokio website     Downloads     Video tutorials     KnowledgeBase  
Alphabetical reordering of words in a string - Visokio Forums
Alphabetical reordering of words in a string
  •     Phillipa February 4, 2016 12:12PM
    Hi,

    I am just wondering if it is possible to reorder words in a string.

    I have a string consisting of various substances (a,b,c & other etc) listed alphabetically. I have just replaced "other" with the substance specified in another field. The problem now is that the list is not in alphabetical order, which is important for us.

    Is there any way of getting the substances back in alphabetical order? For example by expanding them and then collapsing them again alphabetically?

    I would be grateful for any ideas.

    Thanks
    Phillipa
  • 1 Comment
  •     chris February 4, 2016 12:34PM
    Hi Phillipa,

    Thanks for the question. One way to do this would be to use the Tokenise/Detokenise blocks. I've posted an example below:

    Lets say we have some data as follows:


    image


    We want to replace value "FFF" with "BBB" in the "Tags" field. Firstly we use a De-Tokenise block to create a separate record for each token:


    image


    Then we use a Search/Replace block to replace the "FFF" tag with "BBB":


    image


    Now the values are in the wrong order, so we use a Sort block to ensure they are the right order. Note: We must select "Id" field as well as the "Tags" field to ensure the Id order is retained:


    image


    Finally to get the data back to it's original format we can use the "Tokenise" block:


    image


    So we have replaced one of the values and re-sorted the values back to alphabetical order.

    Hope this helps.

    Chris

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Tagged