Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create field with date

Hi,I have 3 fields with Day, Month and Year and would like to get one Date field. Can somebody help me with that?

Later, I would like to use this field in criteria where I want to show only those records where the date is older than the current date. Any clues where I can find my solution?

Thanks

14 Replies
swuehl
MVP
MVP

Try

MakeDate(YearField, MonthField, DayField) as DateField

to create a date field from your three fields.

Regarding your second question, where do you want to use this filter? In the script ( --> look into a WHERE clause) or within a chart (for example, expression could look like sum(if(DateField < today(), Amount)) )

Not applicable
Author

Thanks. I dont know the answer, I have to study it little bit more. I want to show only records of invoices which are overdue and want also to add another field with number of overdue days. If I understand it correct, I have more options, how to do this.

Not applicable
Author

We tried to create a date field from our three fields


MakeDate[[C068_RokSplatnosti],[C067_MesSplatnosti],[C066_DenSplatnosti]] as `DateField` 


but we found a problem


Syntax error (missing operator) in query expression 'MakeDate[[C068_RokSplatnosti]'.


Do you have any advice ?


Not applicable
Author

Hi

Use the following;

MakeDate([C068_RokSplatnosti],[C067_MesSplatnosti],[C066_DenSplatnosti]) as `DateField` 


You were just using the wrong kind of brackets to define the Makedate.




Steve

israrkhan
Specialist II
Specialist II

try below , ( ) was missing

MakeDate([C068_RokSplatnosti],[C067_MesSplatnosti],[C066_DenSplatnosti]) as DateField



Not applicable
Author

I tried that

MakeDate([C068_RokSplatnosti],[C067_MesSplatnosti],[C066_DenSplatnosti]) as `DateField`

but  I found another problem

SQL##f - SqlState: 37000, ErrorCode: 4294964194, ErrorMsg: [Microsoft][ODBC Microsoft Access Driver] Undefined function 'MakeDate' in expression.

israrkhan
Specialist II
Specialist II

can you post your script here... not sure where you are using this funcion.

swuehl
MVP
MVP

You need to use QV functions in the LOAD part, not the SQL part (which is just sent to the DB driver for parsing):

LOAD

      MakeDate([C068_RokSplatnosti],[C067_MesSplatnosti],[C066_DenSplatnosti]) as DateField;

SQL SELECT

     [C068_RokSplatnosti],

     [C067_MesSplatnosti],

     [C066_DenSplatnosti]

FROM ...;

or use an appropriate SQL function in the SQL part instead.

Not applicable
Author

A:

Load

makedate(day field,month field,year field) as date;

sql select *

from database table name;

B:

Load

*

resident A where date > today();

drop A;