Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to replace all instance of the word "JJ" or "Jay Jays" with the word "Refinery" in my module. But these will not be the full field values, so the store name for instance may be "JJ - Cape Town" which I then want to change to "Refinery - Cape Town".
These are on multiple fields so I do NOT want to use the REPLACE function, I want to use the "MAP USING" function.
For some reason it's not working, and I think maybe because I need wildcard characters since I'm only replacing PART of the field values.
Currently I have the following:
RefineryMap:
Mapping LOAD
*
INLINE [
MapString, MapValue
JJ, Refinery];
MAP * using RefineryMap;
Data:
LOAD
*normal load script*
MapSubString() - is the function that could help you here.
Sorry, but where exactly?
Like this?
RefineryMap:
Mapping LOAD
*
INLINE [
MapString, MapValue
JJ, Refinery];
MapSubString * using RefineryMap;
Data:
LOAD
*normal load script*
Please refer -
Well, I see (carefully) your point now. Yes that way it doesn't work. If individual field mapping would be an option, then you could use that function.
From help file.
You could probably run a loop and use the MapSubstring() function as an alternative.
Something Like below
Map1:
Mapping load * inline [
x, y
1, one
2, Two
3, Three ] ;
Data:
LOAD [Employee #],
MapSubstring ('map1', [Employee #]) as NewEmployeeID
FROM
Book1.xlsx
(ooxml, embedded labels, table is Sheet1);
Thanks, but as mentioned, I do not want to do this on every single field that may contain JJ - which is why I want to make use of the MAP...USING statement.
I just need to figure out how to use a wildcard in that function, something like this,
RefineryMap:
Mapping LOAD
*
INLINE [
MapString, MapValue
JJ, Refinery];
MAP '*Field1*', '*Field2*', '*Field3*' using RefineryMap;
Data:
LOAD
*normal load script*
Your script with mapsubstring would be something like:
RefineryMap:
Mapping LOAD
*
INLINE [
MapString, MapValue
JJ, Refinery];
Data:
LOAD
MapSubString('RefineryMap', Code) As Refinary,
*normal load script*
Mapsubstring works like Applymap, except that it looks inside the string ("Code" in the example above) and replaces the substring.