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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DrGenious
Creator
Creator

Routines in tmap

Hi,

I have created a routine which takes an input row and convert it from sting to timestamp. When I use it in tjavarow everyting run smoothly, but when I am trying to call it inside tmap as string_to_timestamp.convert(row6.date) it throws an error : Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

Labels (2)
1 Solution

Accepted Solutions
DrGenious
Creator
Creator
Author

package routines;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.LocalDateTime;
public class string_yyyyMMddHHmmss_to_timestamp
{
// arguments are passed using the text field below this editor
public static String timestamp_conversion(String input)
{
if(!input.equals("")) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "yyyyMMddHHmmss" );
LocalDateTime localDate = LocalDateTime.parse( input , formatter );

String return_date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(localDate);

return return_date;
}else {
return input;
}
}
}

 

I call it inside tmap as : string_yyyyMMddHHmmss_to_timestamp.timestamp_conversion(row9.Call_Date_Time)

View solution in original post

4 Replies
TRF
Champion II
Champion II

Click on the Code tab then in the right margin, click on the red rectangle to go directly where the error is and finally move the mouse over the red cross in the left margin to display the complete compilation error message.

You may also share more such as you routine method definition and the tMap expression where it is used else we can't guess what's the error.

DrGenious
Creator
Creator
Author

package routines;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.LocalDateTime;
public class string_yyyyMMddHHmmss_to_timestamp
{
// arguments are passed using the text field below this editor
public static String timestamp_conversion(String input)
{
if(!input.equals("")) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "yyyyMMddHHmmss" );
LocalDateTime localDate = LocalDateTime.parse( input , formatter );

String return_date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(localDate);

return return_date;
}else {
return input;
}
}
}

 

I call it inside tmap as : string_yyyyMMddHHmmss_to_timestamp.timestamp_conversion(row9.Call_Date_Time)

TRF
Champion II
Champion II

How is defined row9.Call_Date_Time?
What's the compilation error message displayed in code?
DrGenious
Creator
Creator
Author

@TRF 

Somehow it stopped throw me an error now. I restarted the programm and everything runs ok.