Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Eli181
Contributor II
Contributor II

Add New Field in a Table

Hi.

I do not understand why there is an error in my syntax, to create a new field in a table:

Name of the Field:

  • DayNightShift.

The expression is 

  • if(TimeColumn<'16:00:00 PM' AND TimeColumn>='1:00:00AM', 'DayShift','NightShift)

Thank you for your help.

Labels (3)
1 Reply
SukumarBera
Contributor III
Contributor III

Hard to comment without looking at the error description.

However, below are the potential errors I see here.

  • Single quote missing at the end of the expression.
  • Assuming that TimeColumn is holing QV time values , i would recommend to convert the sting literal to proper QV time (using TIME#) so that Qlik engine use internal numeric values during the comparison.

Example-if(TimeColumn<Time#('16:00:00 PM','hh:mm:ssTT') AND TimeColumn>=Time#('1:00:00AM','hh:mm:ssTT'), 'DayShift','NightShift')

 

Thanks & Regards,

Sukumar Bera