DriveWorks Pro 15: SppFindAndReplaceInTable [send feedback...]

SppFindAndReplaceInTable

Returns a table with matching items replaced with new items from a given search table.

Syntax

SppFindAndReplaceInTable([Table Array],[Column],[Include Header In Data to Search],[Include Header In Results],[Table Containing Find And Replace Strings])

Where:

Table Array is a table array such as the data in a standard table or the result of the QueryDataValues function.

Column To Search is the column on which to set the value. A number starting at 1 for the first column, or 0 to find and replace across all columns.

Include Header In Data to Search is TRUE to include header values in the data that is being searched.

Include Header In Results is TRUE to use the same headers as the first row of results.

Table Containing Find And Replace Strings is a 2 column table array (such as the data in a standard table, or the result of a QueryDataValues function), where the first column contains the text to find and the second column is the text to replace.

Example Data

DWLookupProductData

MakeModelColourMileage
VolkswagenGolfBlue40000
FordEscortRed55000
RenaultKangooWhite37000
FordMondeoRed28000
Mazda2Red82000
VolkswagenGolfSilver110000
VolkswagenPoloBlue72000
FordMondeoRed54000
RenaultLagunaBlack46000

DwLookupFindAndReplace

FindReplace
FordFord Motors
VolkswagenVW
MazdaMazda Motor Corporation

Example Rule

RuleMeaning
SppFindAndReplaceInTable(DWLookupProductData,1,TRUE,TRUE,DwLookupFindAndReplace)Will return a table based on the table ProductData but with items found and replaced with the contents of the table FindAndReplace.

Example Outcome

MakeModelColourMileage
VWGolfBlue40000
Ford MotorsEscortRed55000
RenaultKangooWhite37000
Ford MotorsMondeoRed28000
Mazda Motor Corporation2Red82000
VWGolfSilver110000
VWPoloBlue72000
Ford MotorsMondeoRed54000
RenaultLagunaBlack46000

Table of Contents