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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Lara_Zuern
Contributor III
Contributor III

Split Date and Time with NULL-values

Hello there,

I'm struggleing a little bit with the preparation of my data.

From my Excel-File I've got two columns with a Date and Time string. The Format is like this "12.07.2021 09:15:00.000".

Now I tried to seperate this string into two columns, one with the date and one with the time. So I programmed into tJavaFlex the attached code.

I wanted to do the same for the second DateTime-column as well.

My problem with this column is, that some fields are empty. So if I try to seperate with my index-variable I get the error message "String index out of range".

To solve this problem I created an if/else-condition. The if-part worked perfectly well, but I'm struggeling with the else. It should work like this:

If a field is not empty (!=null) the programm should split the column into "Einbau" und "Zeit" else it shpuld write NULL into the "Einbau"-column.

Could anyone help me?

Thanks a lot and see the attached screenshot,

Lara

Labels (3)
1 Reply
Anonymous
Not applicable

Hi

I think you should handle the null value first, eg:

(row1.columnName==null){

row3.dateColumn=null;

row3.timeColumn=null;

}else{

balabala

}

 

Regards

Shong