1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
581 views
by manoj-m-7223 (210 points)
Hi Team,

Need your help for getPart function to use for Array elements and provide with examples of getPart function.

Thanks & Regards,

Manoj
by brandon-w-8204 (34.1k points)
I am not sure what you mean by getPart. Can you please clarify what you are looking to accomplish. We are happy to assist just let us know more details.
by manoj-m-7223 (210 points)
hi Brandon,
Thanks for quick reply.  And im looking for getPart function to use how to get Firstname, middlename and lastname seperately for the Patient name ( Williams, Scott) while translation in QIE. Please correct me once.
Thank you.

2 Answers

0 votes

Here is some sample code:

//Remove ()
var originalName = StringUtils.replace(message.getNode('/'), '(', '');
originalName = StringUtils.replace(originalName, ')', '');

//Split it up
var parts = StringUtils.splitByWholeSeparator(originalName, ',');

//Get Last Name
var lastName = StringUtils.trim(parts[0]);
var firstMiddleName = StringUtils.trim(parts[1]);

//Split first and last name parts
var firstMiddleParts = StringUtils.splitByWholeSeparator(firstMiddleName, ' ');

//Get the first and last names
var firstName = firstMiddleParts[0];
var middleName = firstMiddleParts[1];

qie.debug('firstName: ' + firstName);
qie.debug('middleName: ' + middleName);
qie.debug('lastName: ' + lastName);

by brandon-w-8204 (34.1k points)
0 votes
Hey, Manoj.  That getPart function only exists in our instance of QIE (it is a function we built into our logic for pre-processing data before calling various message.setNode functions), so the broader QIE audience won't know how that function works.

Having said that, the syntax you're looking for would be this, assuming you're parsing a CSV with a column name of "Patient Name"

To get the last name: getPart("Patient Name", ",", 0)

To get the first name: getPart("Patient Name", ",", 1)
by scott-b-8720 (560 points)
...