Tables to text: an example

    Hello,

    I really liked this article here: QlikView App: Send Data In QlikView Alerts

    Now I will show you a scheme how to convert nearly every table into text format for sending it via QlikView Mail Alarm.

    It's not very complicated, but I think it's worth a look.

     

    This is my example table:

    Tab:
    LOAD * INLINE [
    Country, Sales, Comment
    Spain, 1000
    Italy, 25000, short comment
    Great Britain, 6000000000, this is a very long comment
    United States of America, 10000, ?
    ]
    ;

    It consists of 3 columns. At the end, the textbox should look like that:

    (different alignments, sorted descending by sales)

     

    The textbox is calculated by the following expression. Feel free the adapt it to your personal needs!

     

    ='Country'& repeat(' ', Len(MaxString(total Country))-Len('Country')) //left aligned
         &' | ' //row delimiter
         &'Sales' & repeat(' ', Len(MaxString(total money(Sales)))-Len('Sales')) //left aligned
         &' | ' //row delimiter
         & repeat(' ', Len(MaxString(total Comment))-Len('Comment'))&'Comment' //right aligned
    &chr(13) //line break
    &repeat('-',
    Len(MaxString(total Country))
    +
    Len(' | ')
    +
    Len(MaxString(total money(Sales)))
    +
    Len(' | ')
    +
    Len(MaxString(total Comment))
    )
    &
    chr(13) //line break
    &
    concat(
    aggr(

          
    Country& repeat(' ', Len(MaxString(total Country))-Len(Country)) //left aligned
          &' | ' //row delimiter
          &repeat(' ', Len(MaxString(total money(Sales)))-Len(money(Sales))) &money(Sales) //right aligned
          &' | ' //row delimiter
          &Comment& repeat(' ', Len(MaxString(total Comment))-Len(Comment)) //left aligned
         
    ,
    Country,Sales,Comment //place your table fields (dimensions) here
          )
    ,
    chr(13) //line break
    ,-Sales //sort by sales, descending
    )