Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL where condition

Hello,

I'm running below script.

LOAD Distinct

Date(floor(LotStartDateTime),'YYYY-MM-DD hh:mm:ss.fff') as TempMaxDateTime,

Date(WeekEnd(LotStartDateTime),'DD-MM-YYYY') as WeekEndDate

Resident LatestWeek;

Let vWeekEndDate=Peek('WeekEndDate',-1);

Temp1:

LOAD Date(Max(TempMaxDateTime),'DD-MM-YYYY') as MaxDateTime

Resident Temp;

Let vMaxDate=Peek('MaxDateTime',-1);

LOAD *,

     LotStartDateTime AS TempLotStartDateTime

;

SQL SELECT *

FROM "Split Data".dbo."Week2"

Where

Day(LotStartDateTime) >= Day('$(vMaxDate)')

and

Day(LotStartDateTime) <= Day('$(vWeekEndDate)')

;

When i run the above query in qvw file, i'm getting the below error message as shown in second image.

In sql dates are like this

2011-06-08 00:10:12

2011-06-08 14:04:25

2011-06-09 11:00:04

Untitled1.png

Untitled2.png

13 Replies
Not applicable
Author

I think, you should create string variable which contains all SQL + variables (dates) so SQL script is converted to SQL format and only then run the SQL script.  Cause, SQL is using native script enterpritator.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Remember that all the command after SQL is passed to SQL Server and executed there, not by QV. The command must be in a form that SQL Server understands, and the Day function in SQL server does not accept a string parameter.

Use something like this in your original script:

Let vWeekendDate = Date(Peek('WeekEndDate',-1), 'YYYY.MM.DD');

... Day(LotStartDateTime) = Day(Convert(datetime, '#(vWeekendDate)', 102))

Check SQL Books Online for Convert or Cast.

Hope this helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Dear Team,

I have one calendar which is coded in JavaScript. this i wanted to make it as QlikView extension object.

I am sharing the HTML, JavaScript and CSS file for reference.

Please guide / help in doing

Thanks in advance,

Thanks & Regards,

Venkatesh Salla

eTechnoforte FZC, PO Box No 120094,

SAIF Zone, Sharjah, UAE. Phone: +971 6 5578053

Email: <mailto:venkatesh@technoforte.co.in> venkatesh@technoforte.co.in

jonathandienst
Partner - Champion III
Partner - Champion III

Hi V

I suggest that you create a new post for this request. It is not really the same thing as this post and you are more likely to get help.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein