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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Data transformation (Postgres boolean -> Oracle NUM) - Migration

Hi,
Language: Java
Database used: Postgres 8.4 / Oracle 10g
I am trying to use tMap component to transform data from boolean type in Postgres to NUM in Oracle (e.g. if column has value false then insert 0)
This is needed as part of Data migration exercise. Some how I did not find way how to do it. I looked through component tConvertType but that does not seem to be helpful either.
Any help on how to achieve this?
Thanks,
Mahendra
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello
If the data type of output column is BigDecimal, try
row1.columnName==false?new BigDecimal(0) :new BigDecimal(1)

Best regards

shong

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hello Mahendra
Try the following expression on tMap: eg:
tPostgresInput--row1--tMap--tOracleOutput
row1.columnName==false?0:1

Best regards

shong
Anonymous
Not applicable
Author

Hi Shong,
I tried the option suggested by you, but this does not work. I have uploaded the screen shot of the same.
The error message coming up after clicking "Test!" button is
"Type mismatch: cannot convert from int to BigDecimal"
Thanks,
Mahendra
Anonymous
Not applicable
Author

Hello
If the data type of output column is BigDecimal, try
row1.columnName==false?new BigDecimal(0) :new BigDecimal(1)

Best regards

shong
Anonymous
Not applicable
Author

Thanks Shong,
this works.
However I am still getting the message "Exception in thread "main" java.lang.Error: Unresolved compilation problems: ".
Anonymous
Not applicable
Author

Hello
However I am still getting the message "Exception in thread "main" java.lang.Error: Unresolved compilation problems: ".

Does it show the message when you click on 'Test' button? Don't worry, just forget it and I suggest you not to use 'Test' button, it always confuse user eventhough there are not compilation problems in the generated code.
Best regards
shong
Anonymous
Not applicable
Author

Try this using tMap..  row2.Hidden.compareTo(row2.Hidden)