Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to append strings

Guys,

I am very new to QlikView.

I want to append strings in a for loop.

I am iterating a column in a table like this

Table:

LOAD *;

    SQL SELECT t.column_name from column t

    where t.table_id = $(tableid);

    FOR j = 0 to (NoOfRows('Table'-1)

// at this point i need to concatenate column names along with some extra strings.

// pseudo code

// string = string + 'func1(column_name)'; // How to do this QlikView

    next

Can anyone please tell me how to do it in QlikView?

I was trying Concat() like Concat(column_name,',') to see if it can at least to concatenation of column names but QlikView shows syntax error.

My real need is to do this // string = string + 'func1(column_name)';

Saurabh

Guys,

I have provided a sample data.

The output I need is two set of strings.

I need to iterate this one column in excel sheet and generate two strings.

1.  Invoice, Bill, SalesOrder, Sales Receipt

2.  Func1(Invoice, $(pwd)) as Func1Invoice, Func1(Bill, $(pwd)) as Func1Bill, Func1(SalesOrder, $(pwd)) as Func1SalesOrder, Func1(Sales Receipt, $(pwd)) as Func1Sales Receipt

Here 'pwd' is an other string whose value will be used here.

I hope this can help you guys to help me.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ramya

Try

     let vstring =  '$(vstring)' & 'MoreText' ;

Best Regards,     Bill

View solution in original post

7 Replies
tresesco
MVP
MVP

'String1' & 'String2' & ExpressionYouWant   // '&' is concatenation operator.

Anonymous
Not applicable
Author

Ramya

Try

     let vstring =  '$(vstring)' & 'MoreText' ;

Best Regards,     Bill

qlikpahadi07
Specialist
Specialist

little confused can you give us a Demo like or attachment with output,

generally if you want to concatenate two columns Simple write

Column1 & Column2 

Ramya       Saurabh      output will be        "RamyaSaurabh"


or

Column1 &'-'& Column2   will give you        "Ramya-Saurabh"


also

Date

22/Sep/2013


Month(Date) & ' - ' & Year(Date)    will give      Sep - 2013


Might be helpful

Not applicable
Author

Welcome to Qlikview. Please provide an example of what you want to achieve, e.g. sample input and desired output. This will make it easier for us to answer your question.

If you need each value in a certain column to have a fixed string appended, you could simply try:

LOAD

     Column1 & 'Column1' AS Column1,

     Column2 & 'Column2' AS Column2;

SQL LOAD ...

etc.

Not applicable
Author

Hi Ramya,

You can use '&' . It is the concatenation operator in qlikview.

For eg.

'Book'  & ' ' & 'Mark' as Col1 will result in Book Mark

'Hello' & 'Test' as Col2 will result in HelloTest

I think in your case

String & 'Your expression' as String1

should work.

Hope this helps!

It will be easier to provide exact solution if you post a sample app with small data.


CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Concat is to concat the fieldvalues within in one field like to combine morethan one rows.

It can be used in Group by in Script and you can directly use in Presentation in text objects or in charts.

To append strings use & operator between two strings.

Example: ColumnName & 'String' & ColumnName1

Hope it helps

Not applicable
Author

Thanks Bill!

it works.

Thanks to every one who spent some time to help me. it was all helpful and I learnt from each one of them