How to Build Search Text for Media Object Text

Purpose of Document

The purpose of this document is to discover possible opportunity to create text file search against Media Object text file. This document is not meant to encompass all possible scenario you have to search media object text.

Business Scenario:

We have Media Object (ABGT) for a certain address book information. Currently Word Search functionality only covers data from multiple tables whereas some of crucial information are written through Media Object. So we want to store media object information and in searching any key words, our application has to return valid address book number(s).

Limitation:

The length of Media Object is not greater than 3000 characters. In case total number of characters (including spaces) exceed this below example is not able to handle it. All code has to be written in C business function.

Technical requirement:

1. Implement business function which can replace invisible special characters (e.g., '\n', '\r' and '\t' - New Line Feed, Carriage Return and Tab) based on input Media Object text
2. Implment business function to return a words (for example, Oracle Corp Ltd returns Oracle/Corp/Ltd)
3. Read MO Text through System function in Batch Application

Possible Implementation:

Function/UBE Purpose
Rip off Special Characters This function is to rip off special characters
Parse String to Words This function is to split a input string into a series of words using jdeStrtok
Create Word Search This UBE is to create word search table
Structure Member Name Data Item Req I/O Alias Type Usage
szInputMOTEXT [3001] MediaObjectVariableLengthColumn Y I/O TXVC String This is to get actual value from F00165 table. This parameter can hold up to 3000 characters

memset(szInputMOTEXT, _J('\0'),sizeof(szInputMOTEXT)); /* Initialize character array */

/* Obtain the length of input string szInputMOTEXT */
arrayCounter = jdeStrlen((const JCHAR *)(lpDS->szInputMOTEXT));

/* Replace special character with a space */

while ( (i < arrayCounter) )
{
c = (lpDS->szInputMOTEXT[i]);

if (c != _J('\0'))
{
if ( (c != _J('\r')) && (c != _J('\n')) && (c != _J('\t')) )
{
}
else /* else is used to handle it at right position */
{
c = _J(' '); /* put a space */
}
szInputMOTEXT[j] = c;
i++;
j++;
}
else
{
szInputMOTEXT[j] = _J('\0');
i = arrayCounter;
}
}

/* Append Null Character at the end of character array */
jdeStrncpy(lpDS->szInputMOTEXT, (const JCHAR *)(szInputMOTEXT), DIM(lpDS->szInputMOTEXT));
lpDS->szInputMOTEXT[30000] = _J('\0');

Structure Member Name Data Item Req I/O Alias Type Usage
szInputMOTEXT [3001] MediaObjectText Y I MOTEXT String This is to get actual value from F00165 table. Make it sure the length of this parameter is longer than the value returned by Business Function 1. Otherwise there will be memory override which ends in zombie.
szOutputObjectSegment [201] OWObjectName O OMWOBJID String Return words when it meets a space
mnSegmentNumber MathNumeric01 Y I MATH01 MATH_NUMERIC The number of words
cDelimiter EverestEventPoint01 Y I EV01 Char Delimiter. For this example a space
MathNumericToInt(&lpDS->mnSegmentNumber, &iSegmentNum);

pSegment = jdeStrtok(lpDS->szInputMOTEXT, token); /* This API jdeStrtok breaks string into a series of words. Refer below for detail */
for (i = 0; i < iSegmentNum; i++)
{
pSegment = jdeStrtok(NULL, token);
}

if (pSegment != NULL)
{
jdeStrncpyTerminate(lpDS->szOutputObjectSegment, pSegment, DIM(lpDS->szOutputObjectSegment));
}

Batch Application - (Example) Word Search for ABGT

Media Objects(ABGT, <Get Text>, RV Media Object Text, BC Address Number (F0101)(AN8))
//
// 1. Rip off '\n', '\r' and '\t' (invisible c characters)
Rip Off New Line and Return Carriage
RV Media Object Text <> BF szInputMOTEXT
//
// 2. Optional - to count total number of characters
RV mnLength = length([RV Media Object Text])
//
// 3. Initialize variables
VA rpt_cDelimiter_Space = " "
VA rpt_mnSegmentNo_MATH01 = "0"
VA rpt_szParsedString_DL01 = ""
//
// 4. To return words whenever it finds a space (delimiter)
Parse Delimited String - CUSTOM
RV Media Object Text -> BF szInputMOTEXT /* string which got stripped off '\r', '\n' */
VA rpt_szParsedString_DL01 <- BF szOutputObjectSegment
VA rpt_mnSegmentNo_MATH01 -> BF mnSegmentNumber
VA rpt_cDelimiter_Space -> BF cDelimiter
//
// 5. While loop till it meets NULL Charcter '\0'
While VA rpt_szParsedString_DL01 is not equal to <Null>
//
// 6. Below routine has to be written to insert/update table which is used to word search.
// For this example, to preview possible word below conditional section gets called. (replace this with actual table I/O)
// In case you rip off a certain character and change case, put code here.
RV ParsedString_Global = VA rpt_szParsedString_DL01
Do Custom Section(RS parse string)
//
// 7. To search next segments
VA rpt_mnSegmentNo_MATH01 = [VA rpt_mnSegmentNo_MATH01]+1
Parse Delimited String - CUSTOM
RV Media Object Text -> BF szInputMOTEXT /* string which got stripped off '\r', '\n' */
VA rpt_szParsedString_DL01 <- BF szOutputObjectSegment
VA rpt_mnSegmentNo_MATH01 -> BF mnSegmentNumber
VA rpt_cDelimiter_Space -> BF cDelimiter
End While

Other business function to Note:

Function Name Source Module Description Others
AddressBookWordSearchBuild B0100068 Address Book Word Search Build This is good example of how to rip off a certain character based on string value defined in UDC H95/SC
ReplaceCharacterInString_74 B744005 Replace Character In String - COMM - 74 This function enables you to replace a certain character in the input string
DetermineCarriageReturn B4205350 Determine Carriage Return Position To determine the return carriage in the string

And for string manipulation, refer to <Document 658313.1> E1: BSFN: How to Find and Replace Characters in a String with Blank.

Example of this case study:

Sample Media Object Text File

“Without the Oracle Retail solution we could not have grown beyond our 78 stores, and we are on course to surpass 100 locations next year,” says Richard Heyman, CIO, Gordmans. “The Oracle solutions enable our multi-distribution center model and have transformed our business, putting us on course to drive better performance. We are leveraging Oracle to improve product selection, inventory turnover, and our ability to respond faster to customer demand.”

The Oracle Retail solutions provide Gordmans with more immediate insight regarding customer demand and item performance, as well as the tools to offer new assortments and provide customers with trending products, brands, and designers. Gordmans is using the Oracle solutions to offer more diverse and compelling assortments.

Output

“Without
the
Oracle
Retail
solution
we
could
not
have
grown
beyond
our
78
stores,
and
we
are
on
course
to
surpass
100
locations
next
year,”
says
Richard
Heyman,
CIO,
Gordmans.
“The
Oracle
solutions
enable
our
multi-distribution
... (continue till end of whole string)