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

need to get char(39) in a variable

Hello community,

I just recently began looking at qlikview and from what I have seen I like it alot

I already manged to imort my tables from a sybase DB and am currently working on a incremental update script. My problem is in the "where clause".

LET vIncrementalExpression = 'StartTime >= ' & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & ' AND ResultReliablityFlag = 1';

this expression will give me StartTime >= 2012-02-02 16:00:00 AND ResultReliablityFlag = 1 but what I need is:
StartTime >= '2012-02-02 16:00:00' AND ResultReliablityFlag = 1

I made the ' to emphasize them. I have tried the following variations but nothing worked,

LET vIncrementalExpression = 'StartTime >= ' & 'char(39)' & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & 'char(39)' &  ' AND ResultReliablityFlag = 1';

LET vIncrementalExpression = 'StartTime >= ' & char(39) & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & char(39)  & ' AND ResultReliablityFlag = 1'; <--gives an erro because of char(39)

LET vIncrementalExpression = 'StartTime >= ' & "'" & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss')  & "'" & 'AND ResultReliablityFlag = 1';

Any ideas how can wrap ' around my dateTime ?

Thanks.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

LET vIncrementalExpression = 'StartTime >= ' & chr(39) & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & chr(39)  & ' AND ResultReliablityFlag = 1';

i.e. use chr() instead of char()

View solution in original post

4 Replies
swuehl
MVP
MVP

Try

LET vIncrementalExpression = 'StartTime >= ' & chr(39) & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & chr(39)  & ' AND ResultReliablityFlag = 1';

i.e. use chr() instead of char()

stephencredmond
Luminary Alumni
Luminary Alumni

Hi,

Simple, just use CHR(39) 😉

LET vIncrementalExpression = 'StartTime >= '  & chr(39) & date(peek('maxdate'),'YYYY-MM-DD hh:mm:ss') & chr(39) & ' AND ResultReliablityFlag = 1';

Regards,


Stephen


Not applicable
Author

Hahah chr() instead of char(), nevertheless thanks for pointing it out for me

TexasTedder
Contributor
Contributor

HI Swuehl

 

I truly am battling with this one. I just cant get the chr(39) in the right places!

 

LET vd_MaxMonth ='=If(Max(Calendar.FMNum)>=6,Right(Calendar.FY,4)&Num(Max(Calendar.FMNum)-5,'00'))&01,Left(Calendar.FY,4)&Num(Max(Calendar.FMNum)+7,'00')&01)';