Tables to text: an example

    I just recognized that it seems not possible to create html mails with monospaced fonts with the help of QlikView text alerts. So the following text is nothing more than an interesting but apparently not practicable idea. If anybody knows how to achieve monospaced text then please add a comment.

     

    ------------------------

     

    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
         &' | ' //column delimiter
         &'Sales' & repeat(' ', Len(MaxString(total money(Sales)))-Len('Sales')) //left aligned
         &' | ' //column 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
          &' | ' //column delimiter
          &repeat(' ', Len(MaxString(total money(Sales)))-Len(money(Sales))) &money(Sales) //right aligned
          &' | ' //column 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
    )