Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
msmichael
Creator
Creator

Concat date field into string

Hi experts,

I have a date field, I want to concat the dates into a string, each date should be in a pair of single quote.

For example, I have data like below,

data:
LOAD * Inline
[
cob_date
'12/1/2018'
'12/2/2018'
'12/3/2018'
'12/4/2018'
]

 

the string I want is 

'12/1/2018','12/2/2018','12/3/2018','12/4/2018'

 

I defined a variable like this:

vCon_date : =Concat(chr(39) & cob_date & chr(39), ',', cob_date)

but when I put the $(vCon_date) into a text box, I got "Error: Garbage after expression: "," "

Where am I wrong?

the qvw file is attached..

Thanks,

Michael

 

1 Solution

Accepted Solutions
Zhandos_Shotan
Partner - Creator II
Partner - Creator II

Hi!

Use

vCon_date directly instead 

$(vCon_date)

 

Best Regards

View solution in original post

6 Replies
zzyjordan
Creator II
Creator II

Hi, 

Have you tried below script to concat the values?

Untitled.jpg

ZZ

Anil_Babu_Samineni

@msmichael wrote:

 

vCon_date : =Concat(chr(39) & cob_date & chr(39), ',', cob_date)

 


Just remove the Red color text

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Zhandos_Shotan
Partner - Creator II
Partner - Creator II

Hi!

Use

vCon_date directly instead 

$(vCon_date)

 

Best Regards

Anonymous
Not applicable

Hi,

 

vCon_date = Concat(chr(39)&cob_date&chr(39),',')

now check in textbox  =vCon_date 

result : '12/1/2018','12/2/2018','12/3/2018','12/4/2018'

if you given variable calculation without equal sign (=) use $(vCon_date )

Thanks

 

msmichael
Creator
Creator
Author

Hi,

Thanks for your reply. I have to do it in an expression, so can't do it this way..

Michael

 

msmichael
Creator
Creator
Author

Hi,

Thanks for your reply, but I need the dates to be sorted, so can't remove the red color text..

 

Michael