You are not logged in.
Announcement
Unanswered posts
|
Thanks i got it .
I created a Routine to split "11:30;10:01;10:02" . its working fine in eclipse . pls refer the java code below .
String testString = "11:30;10:01;10:02";
String temp[]=testString.split(";");
System.out.println(temp.length);
for(int i =0; i < temp.length ; i++)
System.out.println(temp[i]);
DateFormat dateFormat = new SimpleDateFormat("HH:mm");
Date date = new Date();
String b=dateFormat.format(date);
for(int i =0; i < temp.length ; i++)
{
if(b.equals(temp[i]))
{
System.out.println("True");
}
else
{
System.out.println("False");
}
}
I have tried with this java code by creating routine in talend but there is a problem with array of string because temp[] is a string array .
Kindly suggest me how to work with the same concept in talend asap ..
ya I used tnormalize and im getting the output like i wish
key_id|timings
1 |11:12
1 |17:22
2 |16:29
3 |17:22
but i need to update the same in DB(mysql) but the issue is with Key_id(key column) . it wont allows duplicates .
is there anyother way to solve this issue ?
Hi Nilesh R
Maybe this is another workaround.
Use tNormalize to change data as follows.
| 001 | 12:05 | | 001 | 12:10 | | 002 | 12:30 |
Match current time with all records above. Save the matched key_id into a context variable.
Use tDenoramlize to get previous records and do your update logic.
Regards,
Pedro
Created a routine like below-->
public static String[] split()
{
String testString = "11:30;10:01;10:02";
String c= null;
String temp[]=testString.split(";");
return temp;
}
--------------------------------------------
expected o/p:
11:30
10:01
10:02
but im getting error like image which i attached with this .
can anyone pls suggest me for this issue asap .
Thanks for ur reply
I have tried with index and some string function in tmap , but im getting an error, can u pls post an example for custom routine to split the column with the delimiter "," to an array .
It would be more helpful .
Thanks In Advance
Nilesh R
Hi
You can write a custom routine to split the column with the delimiter "," to an array, and then iterate each item in array and compare it with the current time, if matches, returns true, otherwise, returns false.
On tmap, call this routine to filter the rows.
Best regards
Shong
Hi ,
I have a column name "timings" in .csv file
| key_id | timings |
---------------------------
| 001 | 12:05, 12:10 | --> with comma(,) as delimiter
| 002 | 12:30 |
I have a expression in tmap like , if a timing column values matches with a current time it should update the particular column in DB(Mysql)
for eg : if it meets 12:05 --> it should update | 12:05 , 12:10 |
also if it meets 12:10 --> it should update | 12:05 , 12:10 |
but if it meets 12:30 --> its updating in a column
My issue is its only updating if the column has a single timing and not for the multiple timing like above .
pls anyone help me for this issue ..
Thanks In Advance
Nilesh R