Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Nathan22
Contributor II
Contributor II

how to create a calculation in script to check if field=date then y else n

Hi guys , 

 

i am facing problem in writing a logic as i am new to qlikview to check if the field imported from excel is a date or a text in date format then create a new column =y else new column =n .

Appreciate your help.

 

 

 

Labels (2)
5 Replies
dplr-rn
Partner - Master III
Partner - Master III

if the dates are in consistent format. you could try soemthing like below

If(IsNum(Date#(DateField,'dd/mm/yyyy')),'yes','no') as IsDate

if Datefield is 'adb' it will store no

if it is 21/11/2020 it will store yes

Nathan22
Contributor II
Contributor II
Author

thanks for the reply.

but this formula doesn't work on the below data

Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
Not Required for FSPO Treatment
04/09/2020
Brett_Bleess
Former Employee
Former Employee

In this case I would recommend just doing a check if the first character is numeric or alpha and proceed from there...

The following Help link may put you on the right track, sort of from where the prior post was coming I believe:

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Inter...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Saravanan_Desingh

Try like this.

tab1:
LOAD RowNo() As RowID,*, If(Text Like '*??/??/??*','Y','N') As Flag;
LOAD * INLINE [
    Text
    Not Required for FSPO Treatment
    Not Required for FSPO Treatment
    Not Required for FSPO Treatment
    Not Required for FSPO Treatment
    Not Required for FSPO Treatment
    Not Required for FSPO Treatment
    04/09/2020
];
Saravanan_Desingh

Output.

commQV60.PNG