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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
AbiJeev
Creator
Creator

[resolved] Null column in Databse

Hi ,
  I have nullable columns in database(Integer/Date). When I pass null from file (csv file), its throwing error like ,, is not a type of integer like that.
Input FIle:
A,B,,D.
kindly let me know how to handle this.
Labels (3)
16 Replies
Anonymous
Not applicable

Hi
I have written a wrong Java code in my previous post, it is column value that should be checked and convert to null if it is '0000', I have edited my post. There is no a direct way to replace 0000 with null, you have to write Java code to do it.
Best regards
Shong
AbiJeev
Creator
Creator
Author

Hi Shong,
  Thank you so much for the code, will it replace only the last before column value as null?, because Am not sure of the column 
Anonymous
Not applicable

Hi Shong,
  Thank you so much for the code, will it replace only the last before column value as null?, because Am not sure of the column 

I don't understand your question. BTW, are you a Java programmer?
Best regards
Shong
AbiJeev
Creator
Creator
Author

hi Shong,
The below code will replace only the last column value correct? I don't know which column I will get that 0000 value it may be 1st column or 4th or last. And I am not a Java programmer, I know only the basics of Java.
Anonymous
Not applicable

Hi 
Yes, the above code only check the last column, if the problem might exist in any a column, you need to iterate each column, for example:
ncount=row1.c.getColumnCount();
for(int i=0;i<ncount;i++){
column=row1.c.getColumnMetadata(i);
columnName=column.getName();
String columnValue=(String)row1.c.getColumnValue(columnName);
if(columnValue.contains("0000")){
row1.c.setColumnValue(i, null);
}
}

0683p000009MAvr.png
Best regards
Shong
AbiJeev
Creator
Creator
Author

hi Shong,
Thank you so much.
AbiJeev
Creator
Creator
Author

hi ,
  One more doubt is there a way to remove one column from dynamic schema from incoming file based on column name before loading into database?