Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

In report function field, how to extract specific text from another text field

AM24
Giga Guru

Hello,

 

I am creating a report currently on a table. That table has a description field, pretty much a text field whose value look something like this:

 

Random text

Repository: repository name

Created by: John

 

 

Would I be able to extract just "repository name"? I want this for a report. I was wondering if we can extract that with a functional field in the report. Thank you.

2 REPLIES 2

Bert_c1
Kilo Patron

Hi,

 

I have no idea what a 'functional field' in a report is. However, script logic for your example is:

 

var desc = "Random text\nRepository: repository name\nCreated by: John"
gs.info(desc);

var repoStr = desc.substring(desc.indexOf('Repository: '));
var nl = repoStr.indexOf('\n');  // assuming the desired value is on a line by itself
var repo = repoStr.substring(12, nl);
gs.info('repo = ' + repo + '.');

i think, functional field referring the column create for reporting this "Repository:" values along with other table column, this functional field not a column in source table.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution