- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 03:35 AM - edited 04-22-2023 07:09 AM
Hi All,
I have some strings stored in a field on an Incident form.
example:
field_name = description
It contains the highlighted string: No-conflict,P3-Priority,Chief Testing,xt_mapping:FURIOUS,XTREM, gt_kick:rtr,xt_mention:CC-Dnr-pola,[Google]type_believe:customer,xt_mention:hpi-t9d-brmr,[google]xt_mapping:GROUP
My requirement is to get the data which is stored in xt_mapping and xt_mention fields. It means I wish to get all the data which is stored in both those field in the whole string.
The output should contain FURIOUS and GROUP
For, xt_mention the output should be CC-Dnr-pola and pi-t9d-brmr
Any help would be appreciated, thanks.
Mark this as Helpful / Accept the Solution if this helps.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2023 07:15 AM
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2023 07:53 AM
Hello,
For the first output try the below code
var str='No-conflict,P3-Priority,Chief Testing,xt_mapping:FURIOUS,XTREM, gt_kick:rtr,xt_mention:CC-Dnr-pola,[Google]type_believe:customer,xt_mention:hpi-t9d-brmr,[google]xt_mapping:GROUP';
var test=str.split('xt_mapping')[1];
var aa=test.slice(1,8);
gs.print(aa);
var abc=str.split('xt_mapping')[2];
gs.print(abc);
For the second output try below code.
var str='No-conflict,P3-Priority,Chief Testing,xt_mapping:FURIOUS,XTREM, gt_kick:rtr,xt_mention:CC-Dnr-pola,[Google]type_believe:customer,xt_mention:hpi-t9d-brmr,[google]xt_mapping:GROUP';
var test=str.split('xt_mention')[1];
var aa=test.slice(1,12);
gs.print(aa);
var abc=str.split('xt_mention')[2];
var bb=abc.slice(1,13);
gs.print(bb);
Please mark my answer as helpful/correct if it helps you.
Regards,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2023 01:33 PM
Hi Namrata, thanks for the response.
In the slice operation, you have mentioned the position of those strings but what if we don't know where they will be placed maybe in some other string it will be in different position. Let us suppose in some other list of string it will occur 3 times and the position has also shifted but we don't want to check the position each and every time, we will define the code in schedule job and it will automatically fetch those values.
We need to automate it not provide the position manually and run the code each time. Could you please provide any insight on this situation? Thank you.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2023 11:00 PM
Hello,
For the first output try the code like below.
var str = 'No-conflict,P3-Priority,Chief Testing,xt_mapping:FURIOUS,XTREM, gt_kick:rtr,xt_mention:CC-Dnr-pola,[Google]type_believe:customer,xt_mention:hpi-t9d-brmr,[google]xt_mapping:GROUP';
var abc=str.split('xt_mapping:')[1];
var test1=abc.split(',')[0];
gs.print(test1);
var test2=str.split('xt_mapping:')[2];
gs.print(test2);
For the second output try the code like below.
var abc1=str.split('xt_mention:')[1];
var t1=abc1.split(',')[0];
gs.print(t1);
var abc2=str.split('xt_mention:')[2];
var t2=abc2.split(',')[0];
gs.print(t2);
Please mark my answer as helpful/correct if it helps you.
Regards,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 04:14 AM
Hi Namrata, thanks.
But I am still not getting the desired output. For example:
var str = 'No-conflict,P3-Priority,Chief Testing,xt_mapping:FURIOUS,XTREM, gt_kick:rtr,xt_mention:CC-Dnr-pola,[Google]type_believe:customer,xt_mention:hpi-t9d-brmr,[google]xt_mapping:GROUP, xt_goodies: Testing';
I have added one more tag in the end of the above string, if I will run the same it will give me the output: GROUP,xt_goodies: Testing
But this desired output is only GROUP. So, it should only provide an output that is in between':'(colon) and ','(comma) which is just after that colon.
Could you please assist me with that, thanks.
Mark this as Helpful / Accept the Solution if this helps.