- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 11:28 PM
Hello Team,
I am looking for the help to extract RITM number from the below text. Here date & RITM number will may changes as per the created date .
Text is --- "[01-12-2023 RITM#10273187] Company created"
Thanks in advance
Vinay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 12:14 AM
Hi @Vinay49 ,
Try updated code
var a = '[01-12-2023 RITM#10273187] Company created';
a = a.split(']');
var b = a[0].split(' ');
b = b[1];
gs.info(b);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 12:06 AM
Hi Dinesh,
Thanks for your reply,
It should display the RITM number with "#".
i.e. RITM#10273187. Then only we can use this & query from RITM table.
can you help on it?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 12:14 AM
Hi @Vinay49 ,
Try updated code
var a = '[01-12-2023 RITM#10273187] Company created';
a = a.split(']');
var b = a[0].split(' ');
b = b[1];
gs.info(b);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 03:52 AM
Try this
var a = '[01-12-2023 RITM#10273187] Company created';
a = a.split(']');
var b = a[0].split(' ');
var b_final = b[1].substring(4);
gs.info(b_final);
Result :
*** Script: #10273187
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 09:58 PM
Hi @Vinay49 ,
I trust you are doing great.
Please find the below code for the same :
var text = '[01-12-2023 RITM#10273187] Company created';
text = text.split(']')[0]; // Splits at ']' and takes the first part
var ritmNumber = text.split(' ')[1]; // Splits at space and takes the second part
gs.info(ritmNumber); // Logs the RITM number including '#'
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 10:38 PM
@Vinay49 Use below code for this. You will get the date and RITM separately.
var text = '[01-12-2023 RITM#10273187] Company created';
var splitWithSpace = text.split(' ');
var splitWithBracket = splitWithSpace[0].split('[');
var getDate = splitWithBracket[1];
gs.info("date "+ getDate);
var splitWithHash = splitWithSpace[1].split('#');
var splitWithBracket = splitWithHash[1].split(']');
var getRITM = splitWithHash[0] + splitWithBracket[0];
gs.info("ritm " + getRITM);