Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to use function scripts RW_ParseString and RW_Substring


TechKnowledge Content

SUMMARY

This article describes how to parse a string field and only return part of the field using function scripts RW_Substring and RW_ParseString in Report Writer.

MORE INFORMATION

Read the descriptions and parameters of the function scripts RW_Substring and RW_ParseString and view the examples provided for each function script.

The two function scripts work differently and sometimes one may work better than the other. The RW_Substring function script uses an integer for the starting posting and then an integer for the number of characters to return. The RW_ParseString uses the integer to specify the number of characters per line and then the second integer tells the function what line to print.

The Function Scripts RW_Left and RW_Right can also be used to return parts of a string. More information about these and other stored procedures can be found in the SDK. The SDK can be downloaded from CD2. The document in the SDK with the function script information is named RW_Func.rtf.

RW_Substring

Description:

RW_Substring returns a part of a specified string field and uses the Dexterity substring() function.

Parameters:

in string IN_String. { A string value containing the substring you want }

in integer IN_Start. { An integer indicating the starting position to use }

in integer IN_Length. { An integer indicating the number of characters you want to return }

Return Value:

function returns string OUT_string.

Example of the RW_Substring function script

The example will return characters 5-10 from the Item description field. It will outline how to modify the Detailed Item List report to show the function scripts.

1. In Report Writer (Click Tools, click Customize), Open the report, and then click the Layout button.

2. Create a new calculated field. Give it a name and a result type of String

3. Click the Functions tab, click the User-defined option, and then select a Core of System and a Function of RW_Substring.

4. Add the Function Script.

5. Add the string field you want to parse.

6. Select the fields tab and then insert the string field you want to parse. In this example the Item description field from the Item Master table is used.

7. Add this field.

8. Click the Constants tab and enter an integer indicating the starting position to use. For this example, select 5 to start with the 5th character.

9. Select the Add button to insert the integer.

10. Add the integer for the number of characters you want returned. In this example, you want characters 5-10 to print so enter a 6. Characters 5-10 is 6 characters in length.

11. Pull this calculated field onto the report.

This example will have a calculated expression that is similar to the following:

FUNCTION_SCRIPT(RW_SubstringIV_Item_MSTR.Item Description56 )

RW_ParseString

Description:

RW_ParseString returns the string of the specified line when parsing the supplied string field into lines of a specified length and uses the Dexterity Field_ParseText() function.

Parameters:

in string IN_string. { String Field to Parse }

in integer IN_characters. { Number of Characters per Line }

in integer IN_line. { Line Number to Return }

Return Value:

function returns string OUT_string.

Example of the RW_ParseString function script

This example will return characters 5-9 from the Item description field. It will explain how to modify the Detailed Item List report to show the function scripts.

1. In Report Writer (Click Tools, click Customize), Open the report, and then click the Layout button.

2. Create a new calculated field. Give it a name and a result type of String

3. Select the Functions tab, the User-defined option, and a Core of System and function of RW_ParseString.

4. Add the Function Script.

5. Add the string field to parse.

5. Select the Fields tab and then insert the string field you want to parse. In this example, add the Item description field from the Item Master table.

6. Add the field.

7. Click the Constants tab and enter an integer indicating the number of characters per line. For this example, use a 5 because you want to start with the 6th character in the second line.

8. Select the Add button to insert the integer.

9. Add the integer for the line number to be returned. Characters 6-10 would be on the second line so enter a 2. This would print the second line that contains characters 6-10.

This example will have a calculated expression that is similar to the following:

FUNCTION_SCRIPT(RW_ParseStringIV_Item_MSTR.Item Description52 )

This article was TechKnowledge Document ID: 34430

↑ Back to the top


DISCLAIMER

 

 

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, THE RELIABILITY OR THE ACCURACY OF THE INFORMATION THAT IS CONTAINED IN THE DOCUMENTS AND THE RELATED GRAPHICS PUBLISHED ON THIS WEB SITE (THE “MATERIALS”) FOR ANY PURPOSE. 

THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON-INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS. 

-------------------------------------------------------------------

↑ Back to the top


Keywords: kb, kbnosurvey, kbMBSMigrate, kbMBSPartner, kbhowto

↑ Back to the top

Article Info
Article ID : 862345
Revision : 2
Created on : 2/6/2018
Published on : 2/6/2018
Exists online : False
Views : 109